Posted By

arpo on 04/29/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

damarev
mrbassman12


Simple easing without extrenal API


 / Published in: ActionScript 3
 

Using easing with the API that comes with Flash.

  1. import fl.transitions.*;
  2. import fl.transitions.easing.*;
  3.  
  4. //More info
  5. //http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/transitions/easing/package-detail.html
  6.  
  7. stage.frameRate = 31;
  8.  
  9. var box:Sprite = new Sprite();
  10. box.graphics.beginFill(Math.random() * 0xFFFFFF);
  11. box.graphics.drawRect(0, 0, 100, 350);
  12. box.graphics.endFill();
  13. box.x = 50;
  14. box.y = 10;
  15. addChild(box);
  16.  
  17. var startValue:Number = box.x;
  18. var finishValue:Number = 400;
  19. var duration:Number = 3;
  20. var myTween:Tween = new Tween(box, "x", Strong.easeOut, startValue, finishValue, duration, true);
  21. myTween.looping = true;

Report this snippet  

You need to login to post a comment.