mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Removing a frame from a 2 frame animation would cause an error when a Sprite using that animation next tried to render. Fix #4621
This commit is contained in:
parent
e011706b91
commit
a8a7d45956
2 changed files with 18 additions and 5 deletions
|
@ -80,6 +80,7 @@
|
|||
* `Tilemap.createFromObjects` would ignore the `scene` argument passed in to the method. It's now used (thanks @samme)
|
||||
* Fixed a bug in the WebGL and Canvas Renderers where a Sprite with a `flipX` or `flipY` value set would render the offset frames slightly out of place, causing the animation to appear jittery. Also, the sprite would be out of place by its origin. Fix #4636 #3813 (thanks @jronn @B3L7)
|
||||
* Animations with custom pivots, like those created in Texture Packer with the pivot option enabled, would be mis-aligned if flipped. They now render in the correct position, regardless of scale or flip on either axis. Fix #4155 (thanks @Zax37)
|
||||
* Removing a frame from a 2 frame animation would cause an error when a Sprite using that animation next tried to render. Fix #4621 (thanks @orlicgms)
|
||||
|
||||
### Examples, Documentation and TypeScript
|
||||
|
||||
|
|
|
@ -843,9 +843,11 @@ var Animation = new Class({
|
|||
var len = this.frames.length;
|
||||
var slice = 1 / (len - 1);
|
||||
|
||||
var frame;
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
{
|
||||
var frame = this.frames[i];
|
||||
frame = this.frames[i];
|
||||
|
||||
frame.index = i + 1;
|
||||
frame.isFirst = false;
|
||||
|
@ -855,11 +857,21 @@ var Animation = new Class({
|
|||
if (i === 0)
|
||||
{
|
||||
frame.isFirst = true;
|
||||
frame.isLast = (len === 1);
|
||||
|
||||
if (len === 1)
|
||||
{
|
||||
frame.isLast = true;
|
||||
frame.nextFrame = frame;
|
||||
frame.prevFrame = frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
frame.isLast = false;
|
||||
frame.prevFrame = this.frames[len - 1];
|
||||
frame.nextFrame = this.frames[i + 1];
|
||||
}
|
||||
else if (i === len - 1)
|
||||
}
|
||||
else if (i === len - 1 && len > 1)
|
||||
{
|
||||
frame.isLast = true;
|
||||
frame.prevFrame = this.frames[len - 2];
|
||||
|
|
Loading…
Reference in a new issue