Posted By

hejaaa on 06/07/11


Tagged

point rotation


Versions (?)

Rotation around point


 / Published in: ActionScript 3
 

URL: http://www.joelconnett.com/flex-rotation-around-a-point.html

  1. private function rotateAroundInternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number):void {
  2. var p:Point = m.transformPoint(new Point(x, y));
  3. rotateAroundExternalPoint(m, p.x, p.y, angleDegrees);
  4. }
  5.  
  6. private function rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number):void {
  7. m.translate(-x, -y);
  8. m.rotate(angleDegrees * (Math.PI / 180));
  9. m.translate(x, y);
  10. }

Report this snippet  

You need to login to post a comment.