Easing out & in object that follows mouse curser

Hi,

I’m having difficulties trying to ease in & out an object which follows the mouse curser.

Basically i’m looking for a delayed (ease out) reaction for when I move the mouse, so when the object finally catches up with the curser it eases in.

Here’s a link to the FLA

http://www.abreaks.co.uk/foecentre/Example_5-5a%20rotating%20arrow.fla

Here’s the code as well:

stage.addEventListener (Event.ENTER_FRAME, rotate);
var xvelocity:Number = 2;
var yvelocity:Number = 2;
var vx:Number = 0;
var vy:Number = 0;
var thrust:Number = 0.2;
var myarrow:Arrow = new Arrow();
myarrow.x = stage.stageWidth/2;
myarrow.y = stage.stageHeight/2;
var vr:Number = 5;
addChild (myarrow);
myarrow.gotoAndStop (1);

function rotate (evt:Event):void
{
var dx:Number = stage.mouseX-myarrow.x;
var dy:Number = stage.mouseY-myarrow.y;
var angle:Number = Math.atan2(dy,dx);
myarrow.rotation = angle*180/Math.PI;

}

If anyone could help that would be great!

Kind regards,

LM

Well, I don’t have something that does rotation and easing, but I do have something for just easing. I’m sure you can get the gist of it and add it to your script. Here’s the code (credit to Learning ActionScript 3):


var ball:MovieClip = new Ball();
ball.x = ball.y = 100;
addChild(ball);

addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
function onLoop(evt:Event):void { 
	ball.x += velFriction(ball.x, mouseX, 8);
	ball.y += velFriction(ball.y, mouseY, 8);
}

function velFriction(orig:Number, dest:Number, coeff:Number):Number {
	return (dest-orig)/coeff;
}

cheers sage I will give it a go!!!

Thanks for your help,

LM