Posted By

necnova on 04/08/11


Tagged

elasticas3tweenanimation


Versions (?)

AS3 Elastic Tween Formula


 / Published in: ActionScript 3
 

  1. vx += (targetX - sprite.x) * spring; //'spring': elastic coefficient
  2. vy += (targetY - sprite.y) * spring;
  3.  
  4. sprite.x += (vx *= friction); //'friction': friction force
  5. sprite.y += (vy *= friction);
  6.  
  7.  
  8. //use it inside an OnEnterFrame event handler

Report this snippet  

You need to login to post a comment.