AnimationFrame duration is the duration of the frame if set, msPerFrame is not added

This commit is contained in:
Robert Kowalski 2024-01-26 13:19:54 -05:00
parent 1bfdcfe922
commit 2e4b43be4e
4 changed files with 4 additions and 12 deletions

View file

@ -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

View file

@ -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;
},
/**

View file

@ -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}

View file

@ -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();