Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Try something like this:
var lastTime = (new Date()).getTime();
var process = function(){
var currTime = (new Date()).getTime();
var deltaTime = currTime - lastTime;
lastTime = currTime;
deltaTime /= 1000.0; // получаем в секундах, с дробной частью. просто для удобства
var speed = 1000; // 1000 пикселей в секунду
x += speed * deltaTime;
y += speed * deltaTime;
setTimeout(process, 10);
};
In Chrome and IE9 there are no problems, but in FF - yes, jumps ... :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question