Posted By

adamcoulombe on 10/22/10


Tagged

circle as3 positioning triganomety


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

alptugan
sexyflash
tspitzr
scottwatkins


AS3 Circular Radius Positioning Animation


 / Published in: ActionScript 3
 

URL: http://www.adamcoulombe.info/lab/as3/circle-loop.html

More information, demo & FLA file download at http://www.adamcoulombe.info/lab/as3/circle-loop.html

  1. var mid = new Object();
  2. mid = {x:stage.stageWidth/2,y:stage.stageHeight/2};
  3. var elapsed = 0;
  4.  
  5. addEventListener(Event.ENTER_FRAME,loop);
  6.  
  7. function loop(e){
  8. var rad = elapsed * 0.1;
  9. myBox.x = mid.x + (Math.sin(rad)* rad );
  10. myBox.y = mid.y + (Math.cos(rad)* rad );
  11. elapsed++;
  12. }

Report this snippet  

You need to login to post a comment.