Rotation around point


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



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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.