Easing Coordinates

Utility to turn steps and cubic-bezier
single-transition-timing-functions
into an array of "low-poly" xy-coordinates.
Usage
import { easingCoordinates } from 'easing-coordinates'
easingCoordinates('cubic-bezier(0.5, 0, 0.5, 1)')
easingCoordinates('steps(4)')
Use stepsCoordinates
and cubicCoordinates
methods directly depending on your
data:
import { cubicCoordinates, easingCoordinates, stepsCoordinates } from 'easing-coordinates'
cubicCoordinates(0.42, 0, 1, 1) === easingCoordinates('cubic-bezier(0.42, 0, 1, 1)')
stepsCoordinates(4, 'skip-end') === easingCoordinates('steps(4, skip-end)')
Increase polySteps (default = 10, min = 2) to get a "higer-poly" version of your cubic-bezier
functions.
interface ICoordinate {
x: number
y: number
}
function easingCoordinates(easingFunction: string, polySteps?: number): ICoordinate[]
function stepsCoordinates(steps: number, skip = 'skip-end'): ICoordinate[]
function cubicCoordinates(
x1: number,
y1: number,
x2: number,
y2: number,
polySteps = 10
): ICoordinate[]
Build
(See package.json for more scripts)
npm install
npm run watch
npm run test