module
Eagle::Ease
Overview
Easing curves: functions that reshape progress from 0..1 so motion speeds up, slows down, overshoots or bounces instead of moving at a constant rate.
You usually pass an easing to a tween by name, as in ease: :quad_out. Call the
functions directly when you animate something by hand.
Which one to pick:
_outcurves start fast and settle, which suits things arriving: UI sliding in, a camera stopping._incurves start slow and accelerate, which suits things leaving._in_outcurves are slow at both ends, which suits back-and-forth motion.#back_outovershoots a little and comes back. It makes buttons and popups feel springy.#bounce_outand#elastic_outare playful, for landing items and wobbling icons.
t = 0.5_f32
Ease.quad_out(t) # => 0.75, already three quarters of the way there
Ease.by_name(:bounce_out).call(t)
Extended Modules
Defined in:
eagle/core/tween.crInstance Method Summary
-
#back_in(t : Float32) : Float32
Pulls back slightly before moving forward, like winding up.
-
#back_out(t : Float32) : Float32
Overshoots the target slightly, then settles back.
-
#bounce_in(t : Float32) : Float32
Bounces at the start instead of the end.
-
#bounce_out(t : Float32) : Float32
Bounces against the target like a dropped ball.
-
#by_name(name : Symbol) : Proc(Float32, Float32)
Looks up an easing by symbol, such as
:quad_out. -
#cubic_in(t : Float32) : Float32
Like
#quad_in, but stronger. -
#cubic_in_out(t : Float32) : Float32
Like
#quad_in_out, but stronger. -
#cubic_out(t : Float32) : Float32
Like
#quad_out, but stronger. -
#elastic_out(t : Float32) : Float32
Overshoots and wobbles like a spring before settling.
-
#expo_in(t : Float32) : Float32
Almost still, then a sudden rush at the end.
-
#expo_out(t : Float32) : Float32
Very fast start with a long, soft landing.
-
#linear(t : Float32) : Float32
Constant speed.
-
#quad_in(t : Float32) : Float32
Starts slow and speeds up (t²).
-
#quad_in_out(t : Float32) : Float32
Slow at both ends.
-
#quad_out(t : Float32) : Float32
Starts fast and slows to a stop.
-
#sine_in(t : Float32) : Float32
Gentle acceleration following a quarter sine wave.
-
#sine_in_out(t : Float32) : Float32
Gentle at both ends, good for breathing and hovering motion.
-
#sine_out(t : Float32) : Float32
Gentle deceleration.
Instance Method Detail
Overshoots the target slightly, then settles back. Great for popups.
Looks up an easing by symbol, such as :quad_out. Raises ArgumentError for unknown names.
Starts fast and slows to a stop. A good default for most UI motion.
Gentle at both ends, good for breathing and hovering motion.