AS3 Circular Radius Positioning Animation


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your 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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.