Skip to content

Commit 4d142ad

Browse files
committed
Updated Animation so it now uses the delta values, rather than the time. Smoother and no longer suffers duration peak errors.
1 parent 1eda622 commit 4d142ad

6 files changed

Lines changed: 3 additions & 18 deletions

File tree

v3/src/animation/frame/components/Play.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ var Play = function (key, startFrame)
1515
this.isPlaying = true;
1616
this.pendingRepeat = false;
1717

18-
this.prevTick = this.mainloop.lastFrameTimeMs;
19-
2018
if (anim.showOnStart)
2119
{
2220
this.parent.visible = true;

v3/src/animation/frame/components/Restart.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ var Restart = function (includeDelay)
88
this.isPlaying = true;
99
this.pendingRepeat = false;
1010

11-
this.prevTick = this.mainloop.lastFrameTimeMs;
12-
1311
// Set frame
1412
this.updateFrame(this.currentAnim.frames[0]);
1513

v3/src/animation/frame/components/Resume.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ var Resume = function (fromFrame)
44
{
55
this._paused = false;
66
this.isPlaying = this._wasPlaying;
7-
8-
if (this.isPlaying)
9-
{
10-
this.prevTick = this.mainloop.lastFrameTimeMs;
11-
}
127
}
138

149
if (fromFrame !== undefined)

v3/src/animation/frame/components/Update.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
var Update = function (timestamp)
1+
var Update = function (timestamp, delta)
22
{
33
if (!this.isPlaying)
44
{
55
return;
66
}
77

8-
this.accumulator += (timestamp - this.prevTick) * this._timeScale;
9-
10-
this.prevTick = timestamp;
8+
this.accumulator += delta * this._timeScale;
119

1210
if (this.accumulator >= this.nextTick)
1311
{

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '9887bba0-2b5b-11e7-bb4c-df55298342c3'
2+
build: '2fba6110-2bb8-11e7-b7ee-51481bf3d671'
33
};
44
module.exports = CHECKSUM;

v3/src/components/Animation.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ var Animation = new Class({
1313

1414
this.animationManager = parent.state.sys.anims;
1515

16-
this.mainloop = parent.state.game.mainloop;
17-
1816
this.isPlaying = false;
1917

2018
// Reference to the Phaser.Animation object
@@ -62,8 +60,6 @@ var Animation = new Class({
6260
this.forward = true;
6361

6462
this.accumulator = 0;
65-
66-
this.prevTick = 0;
6763
this.nextTick = 0;
6864

6965
this.repeatCounter = 0;

0 commit comments

Comments
 (0)