Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getBezier(time,p1,cp1,cp2,p2) {
- function b1(t) { return t*t*t }
- function b2(t) { return 3*t*t*(1-t) }
- function b3(t) { return 3*t*(1-t)*(1-t) }
- function b4(t) { return (1-t)*(1-t)*(1-t) }
- var pos = 0;
- pos = p1*b1(time) + cp1*b2(time) + cp2*b3(time) + p2*b4(time);
- // pos = p1*b1(time) + cp1*b2(time) + cp2*b3(time) + p2*b4(time);
- return pos;
- }
- getBezier(time,0.2,0,1,1) * 100; // returns something between 0 and 1, * 100
Advertisement
Add Comment
Please, Sign In to add comment