parseEasing
Reads a CSS easing into an easing function, to play in JavaScript the timing a stylesheet or a design tool export describes. It is the inverse of toCssLinear.
Accepts every CSS <easing-function>:
- the keywords
linear,ease,ease-in,ease-out,ease-in-out,step-start,step-end; cubic-bezier(x1, y1, x2, y2)(see cubicBezier);steps(count[, position])(see steps);linear(0, 0.25 40%, 1): points with optional input positions, as CSS fills them in.
Case and extra spaces are ignored. The input is clamped to [0, 1].
Available since v3.1.5
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
css | string | The CSS easing |
Returns
Section titled “Returns”function | null — The easing function, or null if css is not a valid CSS easing
Examples
Section titled “Examples”Play an exported CSS easing in JavaScript
Section titled “Play an exported CSS easing in JavaScript”Keywords, cubic-bezier(), steps() and linear() are all read.
Reject unknown easings
Section titled “Reject unknown easings”Anything that is not a CSS easing gives null.
