Discuss Scratch

scratchcode1_2_3
Scratcher
1000+ posts

Ease in, Ease out block?

So, I've been making a project that needs ease out. But, to be able to backpack it for future projects, I want to add more speeds too.
The only one that works is the constant setting, and I've tried everything to make it able to ease out. Can someone help me?

Last edited by scratchcode1_2_3 (Feb. 25, 2023 14:32:53)

Spentine
Scratcher
1000+ posts

Ease in, Ease out block?

I created some blocks that eases in / out using sine waves.
define ease in from (x1) (y1) to (x2) (y2) in (secs) secs with intensity: (intensity)
go to x: (x1) y: (y1)
set [t v] to (0)
repeat (((secs) * (30)) - (1))
change [t v] by ((0.033333333) / (secs))
set [u v] to ([sin v] of (([e ^ v] of (([ln v] of (t)) * ((1) / (intensity)))) * (90))
go to x: (((x1) * ((1) - (u))) + ((x2) * (u))) y: (((y1) * ((1) - (u))) + ((y2) * (u)))
end
go to x: (x2) y: (y2)

define ease out from (x1) (y1) to (x2) (y2) in (secs) secs with intensity: (intensity)
go to x: (x1) y: (y1)
set [t v] to (0)
repeat (((secs) * (30)) - (1))
change [t v] by ((0.033333333) / (secs))
set [u v] to ([cos v] of (([e ^ v] of (([ln v] of (t)) * (intensity))) * (90))
go to x: (((x1) * (u)) + ((x2) * ((1) - (u)))) y: (((y1) * (u)) + ((y2) * ((1) - (u))))
end
go to x: (x2) y: (y2)

define ease in out from (x1) (y1) to (x2) (y2) in (secs) secs with intensity: (intensity)
ease out from (x1) (y1) to (((x1) + (x2)) / (2)) (((y1) + (y2)) / (2)) in ((secs) / (2)) secs with intensity: (intensity)
ease in from (((x1) + (x2)) / (2)) (((y1) + (y2)) / (2)) to (x2) (y2) in ((secs) / (2)) secs with intensity: (intensity)

Hope this helps!

Last edited by Spentine (Feb. 25, 2023 17:44:18)

scratchcode1_2_3
Scratcher
1000+ posts

Ease in, Ease out block?

Spentine wrote:

I created some blocks that eases in / out using sine waves.
define ease in from (x1) (y1) to (x2) (y2) in (secs) secs with intensity: (intensity)
go to x: (x1) y: (y1)
set [t v] to (0)
repeat (((secs) * (30)) - (1))
change [t v] by ((0.033333333) / (secs))
set [u v] to ([sin v] of (([e ^ v] of (([ln v] of (t)) * ((1) / (intensity)))) * (90))
go to x: (((x1) * ((1) - (u))) + ((x2) * (u))) y: (((y1) * ((1) - (u))) + ((y2) * (u)))
end
go to x: (x2) y: (y2)

define ease out from (x1) (y1) to (x2) (y2) in (secs) secs with intensity: (intensity)
go to x: (x1) y: (y1)
set [t v] to (0)
repeat (((secs) * (30)) - (1))
change [t v] by ((0.033333333) / (secs))
set [u v] to ([cos v] of (([e ^ v] of (([ln v] of (t)) * (intensity))) * (90))
go to x: (((x1) * (u)) + ((x2) * ((1) - (u)))) y: (((y1) * (u)) + ((y2) * ((1) - (u))))
end
go to x: (x2) y: (y2)

define ease in out from (x1) (y1) to (x2) (y2) in (secs) secs with intensity: (intensity)
ease out from (x1) (y1) to (((x1) + (x2)) / (2)) (((y1) + (y2)) / (2)) in ((secs) / (2)) secs with intensity: (intensity)
ease in from (((x1) + (x2)) / (2)) (((y1) + (y2)) / (2)) to (x2) (y2) in ((secs) / (2)) secs with intensity: (intensity)

Hope this helps!

OH my GOD! That's a lot of math! Thank you so much!!!!!!!!!!!!! DD
Spentine
Scratcher
1000+ posts

Ease in, Ease out block?

You're welcome!

Powered by DjangoBB