How To Slow Down And Speed Up Time In Javascript
I implemented an example of how to pause time in JavaScript. The example is here http://jsfiddle.net/suska/n4g5U/ // Update of Date class to modify getTime method. Date.prototype.o
Solution 1:
Wrote a variant on dooxe's answer to avoid the sudden jumps when changing between time warps.
var milli = Date.prototype.getTime;
var lastTime = (newDate).getTime();
var curTime = 0;
Date.prototype.getTime = function(){
var actualTime = milli.call(this);
curTime += (actualTime - lastTime) * Date._speed;
lastTime = actualTime;
return curTime;
};
Post a Comment for "How To Slow Down And Speed Up Time In Javascript"