An object's position is updated relatively to mouseposition on mousemove (opposite direction). Works perfectly well, but I failed to set up the code with smooth easing as result. The code works in Actionscript (of course in proper syntax) but it doesn't work in jQuery syntax and code-elements. I use "css()" to position the object, "animate() with easing" produces a messy animation.
Any idea how I could implement an easing to this animation?
$().mousemove(function(e){
$(".object").each(function(){
var position = $(this).offset();
var position_x = position.left;
position_x = 0;
var windowwidth = ($(window).width()/2);
var endX = (windowwidth)-(e.pageX);
var speed = 5;
position_x += (endX-position_x)/speed;
$(this).css({'left':position_x});
}); });