i want to implement this animation below:

and i’m create js fiddle to work like that, but i have stack when i want to set a position of (x,y) ..
var interval;
function moveit(left,top) {
$("#obj").css("left",left+'px');
$("#obj").css("top",top+'px');
}
$("#change").click(function(){
var left = $("#left").val(); //posisi x
var top = $("#top").val(); //posisi y
var velocity= 1;
interval = setInterval(function() {
left = parseFloat(left) + parseFloat(velocity);
top = parseFloat(top) + parseFloat(velocity);
console.log('position x = ' + left);
console.log('position y = ' + top);
if(top >= 400 ) {
clearInterval(interval);
}
moveit(left,top);
},10);
});
$("#clear").click(function(){
clearInterval(interval);
});
this is my js fiddle http://jsfiddle.net/viyancs/MxuRP/1/
my question
- how to getting x,y coordinate of that curve by generating code ?
- maybe you have another idea for make this better?
thanks you
Change the y-component of the velocity through time.
http://jsfiddle.net/MxuRP/2/