0.1.2 • Published 12 years ago

cubic-bezier v0.1.2

Weekly downloads
13,751
License
-
Repository
github
Last release
12 years ago

Cubic Bézier solver

A small cubic bézier timing function like CSS3 timing functions.

Build Status

Install

npm install cubic-bezier

Usage

var timingFunction = bezier(p1x, p1y, p2x, p2y, n);

// n is the precision, the higher the more precise, but slower.
// a good approximation is for animations is: duration in ms * 2

var easeIn = bezier(0.42, 0, 1.0, 1.0, 1000);
var linear = bezier(0, 0, 1, 1, 1000);

for (var t = 0; t <= 1; t += 0.001){
	console.log(easeIn(t));
	console.log(linear(t));
}