Skip to main content

Module easing

Module easing 

Source
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

VariantCharacter
LinearConstant speed — robotic
EaseInQuadQuartSlow start, accelerate — Quad is subtle
EaseOutQuadFast start, decelerate — great for exits
EaseInOutQuadSmooth in and out — use for UI elements
EaseInOutCubicThe most natural-feeling general purpose ease
EaseInBackSlight recoil before moving — playful
EaseOutBackOvershoots, settles — satisfying confirmations
EaseInElasticWind-up spring — dramatic entrance
EaseOutElasticRelease spring — poppy, energetic
EaseOutBounceBall bouncing to rest — game UIs
EaseInOutBounceBounce both ends — very expressive
Custom(fn)Your own curve

Enums§

Easing
All built-in easing curves plus a Custom escape hatch.

Functions§

cubic_bezier_ease
Evaluate a CSS cubic-bezier(x1, y1, x2, y2) easing at progress t.
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: .
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: .
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 progress t.
wiggle_ease
Sinusoidal wiggle easing — oscillates around the base linear curve.