MI6

Untitled

MI6
Dec 3rd, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getBezier(time,p1,cp1,cp2,p2) {
  2. function b1(t) { return t*t*t }
  3. function b2(t) { return 3*t*t*(1-t) }
  4. function b3(t) { return 3*t*(1-t)*(1-t) }
  5. function b4(t) { return (1-t)*(1-t)*(1-t) }
  6. var pos = 0;
  7. pos = p1*b1(time) + cp1*b2(time) + cp2*b3(time) + p2*b4(time);
  8. // pos = p1*b1(time) + cp1*b2(time) + cp2*b3(time) + p2*b4(time);
  9. return pos;
  10. }
  11.  
  12. getBezier(time,0.2,0,1,1) * 100; // returns something between 0 and 1, * 100
Advertisement
Add Comment
Please, Sign In to add comment