/ Published in: ActionScript 3
More information, demo & FLA file download at http://www.adamcoulombe.info/lab/as3/circle-loop.html
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var mid = new Object(); mid = {x:stage.stageWidth/2,y:stage.stageHeight/2}; var elapsed = 0; addEventListener(Event.ENTER_FRAME,loop); function loop(e){ var rad = elapsed * 0.1; myBox.x = mid.x + (Math.sin(rad)* rad ); myBox.y = mid.y + (Math.cos(rad)* rad ); elapsed++; }
URL: http://www.adamcoulombe.info/lab/as3/circle-loop.html