diff --git a/changelog/3.80/CHANGELOG-v3.80.md b/changelog/3.80/CHANGELOG-v3.80.md index 0aa698056..18f0493f5 100644 --- a/changelog/3.80/CHANGELOG-v3.80.md +++ b/changelog/3.80/CHANGELOG-v3.80.md @@ -16,6 +16,7 @@ * The `InputManager.onTouchMove` function has been fixed so it now correctly handles touch events on pages that have scrolled horizontally or vertically and shifted the viewport. Fix #6489 (thanks @somechris @hyewonjo) * `Factory.staticBody` had the wrong return type in the docs/TS defs. Fix #6693 (thanks @ddhaiby) * The `Time.Timeline` class didn't show as extending the Event Emitter, or have `config` as an optional argument in the docs / TS defs. Fix #6673 (thanks @ghclark2) +* `Animations.AnimationFrame#duration` is now the complete duration of the frame. Before this included `Animations.AnimationState#msPerFrame` with the value of `Animations.AnimationFrame#duration`. The fix to remove `Animations.AnimationState#msPerFrame` from `Animations.AnimationFrame#duration` has been removed from `Animations.AnimationManager#createFromAseprite` because of this clarification. Fix #6712 (thanks @Nerodon @TomMalitz) ## Examples, Documentation, Beta Testing and TypeScript diff --git a/src/animations/Animation.js b/src/animations/Animation.js index c14815c4e..a4a9da202 100644 --- a/src/animations/Animation.js +++ b/src/animations/Animation.js @@ -362,7 +362,7 @@ var Animation = new Class({ // When is the first update due? state.accumulator = 0; - state.nextTick = state.msPerFrame + state.currentFrame.duration; + state.nextTick = (state.currentFrame.duration) ? state.currentFrame.duration : state.msPerFrame; }, /** @@ -515,7 +515,7 @@ var Animation = new Class({ { state.accumulator -= state.nextTick; - state.nextTick = state.msPerFrame + state.currentFrame.duration; + state.nextTick = (state.currentFrame.duration) ? state.currentFrame.duration : state.msPerFrame; }, /** diff --git a/src/animations/AnimationFrame.js b/src/animations/AnimationFrame.js index 93f9788c6..0269ebc4f 100644 --- a/src/animations/AnimationFrame.js +++ b/src/animations/AnimationFrame.js @@ -115,8 +115,7 @@ var AnimationFrame = new Class({ this.nextFrame = null; /** - * Additional time (in ms) that this frame should appear for during playback. - * The value is added onto the msPerFrame set by the animation. + * The duration, in ms, of this frame of the animation. * * @name Phaser.Animations.AnimationFrame#duration * @type {number} diff --git a/src/animations/AnimationManager.js b/src/animations/AnimationManager.js index e6392582a..fa50b1a81 100644 --- a/src/animations/AnimationManager.js +++ b/src/animations/AnimationManager.js @@ -451,14 +451,6 @@ var AnimationManager = new Class({ } } - // Fix duration to play nice with how the next tick is calculated. - var msPerFrame = totalDuration / animFrames.length; - - animFrames.forEach(function (entry) - { - entry.duration -= msPerFrame; - }); - if (direction === 'reverse') { animFrames = animFrames.reverse();