Easing function catalogue for animations and transitions.
Provides 31 named easing curves (matching the standard set from
CSS/lilt) plus custom cubic bezier support. Used by both
Plushie.Animation.Transition (as atoms encoded for the wire
protocol) and Plushie.Animation (as functions for SDK-side
interpolation).
Named curves
Each curve has a public function that takes a progress value
t in 0.0..1.0 and returns the eased value. Some curves
(back, elastic, bounce) can overshoot the 0..1 range.
Linear
Constant velocity. No acceleration or deceleration.
Sine (ease_in, ease_out, ease_in_out)
Gentle acceleration/deceleration using sine curves. The default
ease_in_out is a good general-purpose choice.
Power curves (quad, cubic, quart, quint)
Increasingly aggressive acceleration. Higher power = sharper start/stop.
Exponential (expo)
Very sharp acceleration. Starts almost stationary, then accelerates rapidly.
Circular (circ)
Based on circular arc geometry. Moderate sharpness.
Back
Overshoots the target slightly before settling. Good for playful, bouncy interfaces.
Elastic
Oscillates around the target like a spring on a rubber band. Large overshoot.
Bounce
Simulates a bouncing ball. Multiple diminishing bounces at the end.
Cubic bezier
For custom curves, pass {:cubic_bezier, x1, y1, x2, y2}:
opacity: transition(300, to: 0.0, easing: {:cubic_bezier, 0.25, 0.1, 0.25, 1.0})Control points match the CSS cubic-bezier() function.
Summary
Functions
Evaluates a cubic bezier easing curve at progress t.
Sine ease in: gentle acceleration.
Back ease in: pulls back before accelerating.
Bounce ease in.
Circular ease in.
Cubic ease in.
Elastic ease in: oscillates then accelerates.
Exponential ease in.
Sine ease in-out: gentle acceleration and deceleration.
Back ease in-out: pulls back and overshoots.
Bounce ease in-out.
Circular ease in-out.
Cubic ease in-out.
Elastic ease in-out.
Exponential ease in-out.
Quadratic ease in-out.
Quartic ease in-out.
Quintic ease in-out.
Quadratic ease in.
Quartic ease in.
Quintic ease in.
Sine ease out: gentle deceleration.
Back ease out: overshoots then settles.
Bounce ease out: bouncing ball effect.
Circular ease out.
Cubic ease out.
Elastic ease out: overshoots with oscillation.
Exponential ease out.
Quadratic ease out.
Quartic ease out.
Quintic ease out.
Returns the Elixir easing function for SDK-side interpolation.
Interpolates a value from a to b at progress t with the
given easing.
Linear easing: constant velocity.
Returns the wire-format string for an easing spec.
Returns the list of all named easing atoms.
Returns true if the value is a valid easing spec.
Types
@type named() ::
:linear
| :ease_in
| :ease_out
| :ease_in_out
| :ease_in_quad
| :ease_out_quad
| :ease_in_out_quad
| :ease_in_cubic
| :ease_out_cubic
| :ease_in_out_cubic
| :ease_in_quart
| :ease_out_quart
| :ease_in_out_quart
| :ease_in_quint
| :ease_out_quint
| :ease_in_out_quint
| :ease_in_expo
| :ease_out_expo
| :ease_in_out_expo
| :ease_in_circ
| :ease_out_circ
| :ease_in_out_circ
| :ease_in_back
| :ease_out_back
| :ease_in_out_back
| :ease_in_elastic
| :ease_out_elastic
| :ease_in_out_elastic
| :ease_in_bounce
| :ease_out_bounce
| :ease_in_out_bounce
Functions
@spec cubic_bezier( t :: float(), x1 :: float(), y1 :: float(), x2 :: float(), y2 :: float() ) :: float()
Evaluates a cubic bezier easing curve at progress t.
Control points (x1, y1) and (x2, y2) match the CSS
cubic-bezier() function. The curve starts at (0, 0) and
ends at (1, 1).
Uses Newton-Raphson iteration to solve for the parameter given the x coordinate, then evaluates y at that parameter.
Sine ease in: gentle acceleration.
Back ease in: pulls back before accelerating.
Bounce ease in.
Circular ease in.
Cubic ease in.
Elastic ease in: oscillates then accelerates.
Exponential ease in.
Sine ease in-out: gentle acceleration and deceleration.
Back ease in-out: pulls back and overshoots.
Bounce ease in-out.
Circular ease in-out.
Cubic ease in-out.
Elastic ease in-out.
Exponential ease in-out.
Quadratic ease in-out.
Quartic ease in-out.
Quintic ease in-out.
Quadratic ease in.
Quartic ease in.
Quintic ease in.
Sine ease out: gentle deceleration.
Back ease out: overshoots then settles.
Bounce ease out: bouncing ball effect.
Circular ease out.
Cubic ease out.
Elastic ease out: overshoots with oscillation.
Exponential ease out.
Quadratic ease out.
Quartic ease out.
Quintic ease out.
Returns the Elixir easing function for SDK-side interpolation.
The returned function takes a float t in 0.0..1.0 and
returns the eased progress value.
Interpolates a value from a to b at progress t with the
given easing.
iex> Easing.interpolate(0.0, 100.0, 0.5, :linear)
50.0
Linear easing: constant velocity.
Returns the wire-format string for an easing spec.
@spec named_easings() :: [named()]
Returns the list of all named easing atoms.
Returns true if the value is a valid easing spec.