Expand description
Easing functions — the feel of every animation.
An easing function maps a linear progress value t ∈ [0.0, 1.0] to a
curved output, giving animations their character: a bounce, an elastic
snap, a smooth deceleration.
§Usage
use spanda::easing::Easing;
let t = 0.5_f32;
let curved = Easing::EaseOutBounce.apply(t);You can also call the free functions directly for zero-overhead use:
use spanda::easing::ease_out_elastic;
let t = ease_out_elastic(0.7);§Cheat-sheet
| Variant | Character |
|---|---|
Linear | Constant speed — robotic |
EaseInQuad…Quart | Slow start, accelerate — Quad is subtle |
EaseOutQuad… | Fast start, decelerate — great for exits |
EaseInOutQuad… | Smooth in and out — use for UI elements |
EaseInOutCubic | The most natural-feeling general purpose ease |
EaseInBack | Slight recoil before moving — playful |
EaseOutBack | Overshoots, settles — satisfying confirmations |
EaseInElastic | Wind-up spring — dramatic entrance |
EaseOutElastic | Release spring — poppy, energetic |
EaseOutBounce | Ball bouncing to rest — game UIs |
EaseInOutBounce | Bounce both ends — very expressive |
Custom(fn) | Your own curve |
Enums§
- Easing
- All built-in easing curves plus a
Customescape hatch.
Functions§
- cubic_
bezier_ ease - Evaluate a CSS
cubic-bezier(x1, y1, x2, y2)easing at progresst. - custom_
bounce - Parametric bounce with configurable strength and squash.
- ease_
in_ back - Back ease-in: pulls back slightly before accelerating forward.
- ease_
in_ bounce - Bounce ease-in: bounces at the start before settling in.
- ease_
in_ circ - Circular ease-in: arc-shaped slow start.
- ease_
in_ cubic - Cubic ease-in:
t³. - ease_
in_ elastic - Elastic ease-in: wind-up spring effect before launching.
- ease_
in_ expo - Exponential ease-in: nearly frozen then sudden burst.
- ease_
in_ out_ back - Back ease-in-out: pulls back at start, overshoots at end.
- ease_
in_ out_ bounce - Bounce ease-in-out: bounces at both start and end.
- ease_
in_ out_ circ - Circular ease-in-out: arc-shaped acceleration and deceleration.
- ease_
in_ out_ cubic - Cubic ease-in-out: smooth acceleration then deceleration.
- ease_
in_ out_ elastic - Elastic ease-in-out: spring wind-up and release both ends.
- ease_
in_ out_ expo - Exponential ease-in-out: extreme contrast between slow and fast.
- ease_
in_ out_ quad - Quadratic ease-in-out: smooth acceleration then deceleration.
- ease_
in_ out_ quart - Quartic ease-in-out: pronounced slow-fast-slow.
- ease_
in_ out_ quint - Quintic ease-in-out: very dramatic slow-fast-slow.
- ease_
in_ out_ sine - Sinusoidal ease-in-out: smooth and natural sine-based curve.
- ease_
in_ quad - Quadratic ease-in:
t². - ease_
in_ quart - Quartic ease-in:
t⁴. - ease_
in_ quint - Quintic ease-in:
t⁵. - ease_
in_ sine - Sinusoidal ease-in: gentle acceleration using a sine curve.
- ease_
out_ back - Back ease-out: overshoots the target, then settles back.
- ease_
out_ bounce - Bounce ease-out: ball bouncing to rest.
- ease_
out_ circ - Circular ease-out: arc-shaped fast start.
- ease_
out_ cubic - Cubic ease-out:
1 - (1-t)³. - ease_
out_ elastic - Elastic ease-out: spring release with oscillating overshoot.
- ease_
out_ expo - Exponential ease-out: rapid start, gradually stops.
- ease_
out_ quad - Quadratic ease-out:
1 - (1-t)². - ease_
out_ quart - Quartic ease-out:
1 - (1-t)⁴. - ease_
out_ quint - Quintic ease-out:
1 - (1-t)⁵. - ease_
out_ sine - Sinusoidal ease-out: gentle deceleration using a sine curve.
- expo_
scale - Perceptual exponential scale correction.
- linear
- Linear easing — identity function, constant speed.
- rough_
ease - Deterministic rough/jittery easing — noise overlaid on a linear curve.
- slow_mo
- Slow-fast-slow piecewise easing for dramatic effects.
- steps_
ease - Evaluate a CSS
steps(n)easing at progresst. - wiggle_
ease - Sinusoidal wiggle easing — oscillates around the base linear curve.