Posted By

TheRabbitFlash on 08/05/14


Tagged

angle radius


Versions (?)

Moving object around center


 / Published in: ActionScript 3
 

Using this code you can move your object along radius

  1. // Center of point by X and Y
  2. var centerX : Number = 150;
  3. var centerY : Number = 150;
  4.  
  5. // Radius (how far away your object will fly near your center)
  6. var radius : Number = 50;
  7.  
  8. // Change angle to move by circle path
  9. var angle : Number = 90;
  10.  
  11. // img it's display object
  12. img.x = centerX + radius * Math.cos(angle);
  13. img.y = centerY + radius * Math.sin(angle);

Report this snippet  

You need to login to post a comment.