Skip to content

animation

Animation timing without a framework: Easing curves (the CSS keywords, cubic-bezier(), steps() and linear(), read from a CSS string or built directly), physical Springs with their settling time, and to_css_linear to turn any curve into a CSS linear().

The same model as the TypeScript package’s animation category, for code that computes animation values itself (a renderer, a native player, a tool that exports animations).

Cargo feature animation (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features animation

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.9", default-features = false, features = ["animation"] }

Import path: helpers4::animation.

ItemWhat it does
EasingA timing curve: how the progress of an animation follows the progress of time, from 0.0 to 1.0.
SpringA damped spring going from 0.0 to 1.0: the curve behind “spring” transitions of design tools, with the time it takes to settle.
StepPositionWhere the jumps of a steps() easing happen, as in CSS.
to_css_linearSamples an easing function into a CSS linear() easing, so that any curve (a Spring, a custom bounce) can be played by CSS transitions and the Web Animations API, which do not take code.

Documented on the page of the helper that returns them.

TypeReturned by
ParseEasingErrorEasing