We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5d486e1 commit 302033bCopy full SHA for 302033b
src/Director.js
@@ -12,6 +12,9 @@ MathBox.Director = function (stage, script) {
12
13
this.step = 0;
14
this.lastCommand = 0;
15
+
16
+ this.time = 0;
17
+ this.lastTime = +new Date();
18
};
19
20
MathBox.Director.prototype = {
@@ -25,6 +28,14 @@ MathBox.Director.prototype = {
25
28
}
26
29
if (reset || !this.clocks[step]) this.clocks[step] = +new Date();
27
30
return (+new Date() - this.clocks[step]) * .001;
31
32
+ var now = +new Date();
33
+ var delta = now - this.lastTime;
34
+ this.time += delta * this.stage().speed();
35
+ this.lastTime = now;
36
37
+ if (reset || !this.clocks[step]) this.clocks[step] = this.time;
38
+ return (this.time - this.clocks[step]) * .001;
39
},
40
41
/**
0 commit comments