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:

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.cr

Instance Method Summary

Instance Method Detail

def back_in(t : Float32) : Float32 #

Pulls back slightly before moving forward, like winding up.


def back_out(t : Float32) : Float32 #

Overshoots the target slightly, then settles back. Great for popups.


def bounce_in(t : Float32) : Float32 #

Bounces at the start instead of the end.


def bounce_out(t : Float32) : Float32 #

Bounces against the target like a dropped ball.


def by_name(name : Symbol) : Proc(Float32, Float32) #

Looks up an easing by symbol, such as :quad_out. Raises ArgumentError for unknown names.


def cubic_in(t : Float32) : Float32 #

Like #quad_in, but stronger.


def cubic_in_out(t : Float32) : Float32 #

Like #quad_in_out, but stronger.


def cubic_out(t : Float32) : Float32 #

Like #quad_out, but stronger.


def elastic_out(t : Float32) : Float32 #

Overshoots and wobbles like a spring before settling.


def expo_in(t : Float32) : Float32 #

Almost still, then a sudden rush at the end.


def expo_out(t : Float32) : Float32 #

Very fast start with a long, soft landing.


def linear(t : Float32) : Float32 #

Constant speed.


def quad_in(t : Float32) : Float32 #

Starts slow and speeds up (t²).


def quad_in_out(t : Float32) : Float32 #

Slow at both ends.


def quad_out(t : Float32) : Float32 #

Starts fast and slows to a stop. A good default for most UI motion.


def sine_in(t : Float32) : Float32 #

Gentle acceleration following a quarter sine wave.


def sine_in_out(t : Float32) : Float32 #

Gentle at both ends, good for breathing and hovering motion.


def sine_out(t : Float32) : Float32 #

Gentle deceleration.