Return to Snippet

Revision: 44262
at April 8, 2011 19:17 by necnova


Initial Code
var dx:Number = sprite.x - fixedX; 
var dy:Number = sprite.y - fixedY; 

var angle:Number = Math.atan2(dy, dx); 

var targetX:Number = fixedX + Math.cos(angle) * springLength; 
var targetY:Number = fixedX + Math.sin(angle) * springLength;

Initial URL

                                

Initial Description
**mostly used inside an onEnterFrame event handler

Initial Title
AS3 Flexible Partial Shifts Formula

Initial Tags

                                

Initial Language
ActionScript 3