Posted By

erosmarcon on 05/17/12


Tagged

circle trigonometry sin motion Cos


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

doctorstones
PawelGIX


Circular movement


 / Published in: ActionScript 3
 

Circular movement formula

  1. var ball:Sprite;
  2. var angle:Number=0;
  3. var centerX:Number=100;
  4. var centerY:Number=200;
  5. var radius:Number=50;
  6. var speed:Number=.1;
  7.  
  8. function enterFrameHandler(e:Event):void
  9. {
  10. ball.x=centerX+Math.sin(angle)*radius;
  11. ball.y=centerY+Math.cos(angle)*radius
  12. angle+=speed;
  13. }

Report this snippet  

You need to login to post a comment.