I am attempting to move movieclips 1 pixel by a given angle using the Point.polar() method. I am under the impression that moving a movieclip 1 pixel by a certain angle and then increasing that angle by 1 degree 360 times in a row should result in the movieclip returning to its original position. I am finding, however, that the movieclip ends at (191.20000000000002, 191.20000000000002) if its original point was (200, 200).
I must have missed something, and would love to understand this method properly. Any interest in my question is greatly appreciated.
This code takes for granted the existence of a movieclip “libraryItem” in the library.
stop();
import fl.motion.MatrixTransformer;
import flash.geom.*
var visibleGraphic:libraryItem = new libraryItem;
visibleGraphic.x = 200, visibleGraphic.y = 200;
var movementTimer:Timer = new Timer (25, 360);
var movementAngle:Number = 0;
this.addChild( visibleGraphic );
movementTimer.addEventListener(TimerEvent.TIMER, movementFunction);
movementTimer.start();
function movementFunction(event:Event):void {
var movementMatrix = visibleGraphic.transform.matrix;
var destinationPoint:Point = Point.polar(1, 2 * Math.PI * (movementAngle / 360));
movementMatrix.translate(destinationPoint.x, destinationPoint.y);
visibleGraphic.transform.matrix = movementMatrix;
movementAngle += 1;
trace(visibleGraphic.x, visibleGraphic.y);
}