diff --git a/examples/compositeManipulation.js b/examples/compositeManipulation.js index d95d95e..3d56e6b 100644 --- a/examples/compositeManipulation.js +++ b/examples/compositeManipulation.js @@ -52,7 +52,7 @@ Example.compositeManipulation = function() { Events.on(engine, 'afterUpdate', function(event) { var time = engine.timing.timestamp, - timeScale = event.delta / 1000; + timeScale = (event.delta || (1000 / 60)) / 1000; Composite.translate(stack, { x: Math.sin(time * 0.001) * 10 * timeScale, diff --git a/examples/manipulation.js b/examples/manipulation.js index 008361f..31d4126 100644 --- a/examples/manipulation.js +++ b/examples/manipulation.js @@ -64,7 +64,7 @@ Example.manipulation = function() { scaleRate = 0.6; Events.on(engine, 'beforeUpdate', function(event) { - var timeScale = event.delta / 1000; + var timeScale = (event.delta || (1000 / 60)) / 1000; if (scaleRate > 0) { Body.scale(bodyF, 1 + (scaleRate * timeScale), 1 + (scaleRate * timeScale)); diff --git a/src/core/Engine.js b/src/core/Engine.js index 1e38d2d..f4e9e39 100644 --- a/src/core/Engine.js +++ b/src/core/Engine.js @@ -343,6 +343,7 @@ var Body = require('../body/Body'); * @event beforeUpdate * @param {} event An event object * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {number} event.delta The delta time in milliseconds value used in the update * @param {} event.source The source object of the event * @param {} event.name The name of the event */ @@ -353,6 +354,7 @@ var Body = require('../body/Body'); * @event afterUpdate * @param {} event An event object * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {number} event.delta The delta time in milliseconds value used in the update * @param {} event.source The source object of the event * @param {} event.name The name of the event */ @@ -388,6 +390,7 @@ var Body = require('../body/Body'); * @param {} event An event object * @param {} event.pairs List of affected pairs * @param {number} event.timestamp The engine.timing.timestamp of the event + * @param {number} event.delta The delta time in milliseconds value used in the update * @param {} event.source The source object of the event * @param {} event.name The name of the event */