Elastic Rotation

I have proper code to make objects rotate on an axis adjacent to the mouse.
I also have proper code on how to make objects elastically bounce towards a specific x,y coordinate.

So far the code I have is for the object to follow the mouse when clicked. when the mouse is up, the objects (on a rotational axis) wind back to original position.

What I would like to do, is combine the formulas for rotation with the elastic formulas to bounce these objects back into place with rotational movement.

Here is the code so far:



rams.addEventListener(MouseEvent.MOUSE_DOWN, mousedown);

function onLoop(event:Event):void {
	var dx:Number = mouseX - rams.x;
	var dy:Number = mouseY - (rams.y + 230);
	var radians:Number = Math.atan2(dy, dx);
	rams.rotation = radians * 180/Math.PI;
}

function onReleas(event:Event):void {
	var ex:Number = 1000 - rams.x;
	var ey:Number = 370 - rams.y;
	var radians:Number = Math.atan2(ey, ex);
	rams.rotation = radians * 180/Math.PI;
}

function mousedown(event:MouseEvent):void {
	rams.removeEventListener(Event.ENTER_FRAME, onReleas);
	rams.addEventListener(MouseEvent.MOUSE_UP, mouseup);
	rams.addEventListener(Event.ENTER_FRAME, onLoop);	
}

function mouseup(event:MouseEvent):void {
	rams.removeEventListener(Event.ENTER_FRAME, onLoop);
	rams.removeEventListener(MouseEvent.MOUSE_UP, mouseup);
	rams.addEventListener(Event.ENTER_FRAME, onReleas);
}


If anybody has any tips that would be much appreciated.