Moving object around center


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

Using this code you can move your object along radius


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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.