mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 17:58:23 +00:00
Moved request below callback. Ignore the argument and use performance.now instead for consistency with input events.
This commit is contained in:
parent
50a167a960
commit
4681bb888d
1 changed files with 8 additions and 5 deletions
|
@ -92,16 +92,19 @@ var RequestAnimationFrame = new Class({
|
|||
* @type {FrameRequestCallback}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.step = function step (timestamp)
|
||||
this.step = function step ()
|
||||
{
|
||||
// Because we cannot trust the time passed to this callback from the browser and need it kept in sync with event times
|
||||
var timestamp = window.performance.now();
|
||||
|
||||
// DOMHighResTimeStamp
|
||||
_this.lastTime = _this.tick;
|
||||
|
||||
_this.tick = timestamp;
|
||||
|
||||
_this.timeOutID = window.requestAnimationFrame(step);
|
||||
|
||||
_this.callback(timestamp);
|
||||
|
||||
_this.timeOutID = window.requestAnimationFrame(step);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -122,9 +125,9 @@ var RequestAnimationFrame = new Class({
|
|||
|
||||
_this.tick = d;
|
||||
|
||||
_this.timeOutID = window.setTimeout(stepTimeout, delay);
|
||||
|
||||
_this.callback(d);
|
||||
|
||||
_this.timeOutID = window.setTimeout(stepTimeout, delay);
|
||||
};
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue