mirror of
https://github.com/liabru/matter-js.git
synced 2024-12-27 13:59:01 -05:00
fix issues with engine event.delta
This commit is contained in:
parent
8cfc234b5b
commit
6f5af774ce
3 changed files with 5 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue