plushie/animation/easing

Named easing curves for animations and transitions.

Provides named easing curves (matching the standard set from CSS/lilt) plus custom cubic bezier support. Used by transitions (as wire-format PropValues) and SDK-side interpolation (as pure functions via apply).

Named curves: Linear, EaseIn/Out/InOut (sine), Quad, Cubic, Quart, Quint, Expo, Circ, Back, Elastic, Bounce. CubicBezier allows custom curves matching CSS cubic-bezier().

Types

Easing curve specification.

Named variants correspond to the standard CSS easing functions. EaseIn/EaseOut/EaseInOut are sine-based (identical to the EaseInSine/EaseOutSine/EaseInOutSine variants). CubicBezier allows custom curves with control points matching the CSS cubic-bezier() function.

pub type Easing {
  Linear
  EaseIn
  EaseOut
  EaseInOut
  EaseInQuad
  EaseOutQuad
  EaseInOutQuad
  EaseInCubic
  EaseOutCubic
  EaseInOutCubic
  EaseInQuart
  EaseOutQuart
  EaseInOutQuart
  EaseInQuint
  EaseOutQuint
  EaseInOutQuint
  EaseInSine
  EaseOutSine
  EaseInOutSine
  EaseInExpo
  EaseOutExpo
  EaseInOutExpo
  EaseInCirc
  EaseOutCirc
  EaseInOutCirc
  EaseInBack
  EaseOutBack
  EaseInOutBack
  EaseInElastic
  EaseOutElastic
  EaseInOutElastic
  EaseInBounce
  EaseOutBounce
  EaseInOutBounce
  CubicBezier(x1: Float, y1: Float, x2: Float, y2: Float)
}

Constructors

  • Linear
  • EaseIn
  • EaseOut
  • EaseInOut
  • EaseInQuad
  • EaseOutQuad
  • EaseInOutQuad
  • EaseInCubic
  • EaseOutCubic
  • EaseInOutCubic
  • EaseInQuart
  • EaseOutQuart
  • EaseInOutQuart
  • EaseInQuint
  • EaseOutQuint
  • EaseInOutQuint
  • EaseInSine
  • EaseOutSine
  • EaseInOutSine
  • EaseInExpo
  • EaseOutExpo
  • EaseInOutExpo
  • EaseInCirc
  • EaseOutCirc
  • EaseInOutCirc
  • EaseInBack
  • EaseOutBack
  • EaseInOutBack
  • EaseInElastic
  • EaseOutElastic
  • EaseInOutElastic
  • EaseInBounce
  • EaseOutBounce
  • EaseInOutBounce
  • CubicBezier(x1: Float, y1: Float, x2: Float, y2: Float)

Values

pub fn apply(easing: Easing, t: Float) -> Float

Evaluate the easing curve at progress t (0.0 to 1.0).

Some curves (back, elastic, bounce) can produce values outside the 0.0 to 1.0 range (overshoot).

pub fn encode(easing: Easing) -> node.PropValue

Encode an easing to its wire-format PropValue.

Named easings become a StringVal. CubicBezier becomes a DictVal with a "cubic_bezier" key holding [x1, y1, x2, y2].

pub fn name(easing: Easing) -> String

Returns the wire-format name for an easing (snake_case string).

CubicBezier returns “cubic_bezier”.

pub fn valid(easing: Easing) -> Bool

Returns True if the easing value is valid.

Named easings are always valid. CubicBezier requires control point x-coordinates in the 0.0 to 1.0 range (y-coordinates are unconstrained, matching CSS behavior).

Search Document