You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/bl
31
31
* Tilemap.addTilesetImage will now raise a console.warn if you specify an invalid tileset key and not create the tileset rather than pick the default set.
32
32
* Math.smoothstep and Math.smootherstep have been updated to work regardless if a is > or < b (thanks @gre, fix #772)
33
33
* Text.updateText now sets the lineCap to `round` to avoid occassional font glitching issues in Chrome.
34
+
* Loader now uses XDomainRequest in IE9 to load JSON data to help with CORS issues.
* Sets this animations playback to a given frame with the given ID.
749
+
*
750
+
* @method Phaser.Animation#setFrame
751
+
* @param {string|number} [frameId] - The identifier of the frame to set. Can be the name of the frame, the sprite index of the frame, or the animation-local frame index.
752
+
* @param {boolean} [useLocalFrameIndex=false] - If you provide a number for frameId, should it use the numeric indexes of the frameData, or the 0-indexed frame index local to the animation.
753
+
*/
754
+
setFrame: function(frameId, useLocalFrameIndex) {
755
+
756
+
var frameIndex;
757
+
758
+
if (typeof useLocalFrameIndex === 'undefined')
759
+
{
760
+
useLocalFrameIndex = false;
761
+
}
762
+
763
+
// Find the index to the desired frame.
764
+
if (typeof frameId === "string")
765
+
{
766
+
for (var i = 0; i < this._frames.length; i++)
767
+
{
768
+
if (this._frameData.getFrame(this._frames[i]).name === frameId)
769
+
{
770
+
frameIndex = i;
771
+
}
772
+
}
773
+
}
774
+
else if (typeof frameId === "number")
775
+
{
776
+
if (useLocalFrameIndex)
777
+
{
778
+
frameIndex = frameId;
779
+
}
780
+
else
781
+
{
782
+
for (var i = 0; i < this._frames.length; i++)
783
+
{
784
+
if (this.frames[i] === frameIndex)
785
+
{
786
+
frameIndex = i;
787
+
}
788
+
}
789
+
}
790
+
}
791
+
792
+
if (frameIndex)
793
+
{
794
+
// Set the current frame index to the found index. Subtract 1 so that it animates to the desired frame on update.
795
+
this._frameIndex = frameIndex - 1;
796
+
797
+
// Make the animation update at next update
798
+
this._timeNextFrame = this.game.time.now;
799
+
800
+
this.update();
801
+
}
802
+
803
+
},
804
+
743
805
/**
744
806
* Stops playback of this animation and set it to a finished state. If a resetFrame is provided it will stop playback and set frame to the first in the animation.
745
807
* If `dispatchComplete` is true it will dispatch the complete events, otherwise they'll be ignored.
* @param {number} stop - The number to count to. If your frames are named 'explosion_0001' to 'explosion_0034' the stop value is 34.
1047
1108
* @param {string} [suffix=''] - The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'.
1048
1109
* @param {number} [zeroPad=0] - The number of zeroes to pad the min and max values with. If your frames are named 'explosion_0001' to 'explosion_0034' then the zeroPad is 4.
1110
+
* @return {array} An array of framenames.
1049
1111
*/
1050
1112
Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zeroPad) {
0 commit comments