Skip to content

Commit 9f9c7de

Browse files
committed
Added setProgress
1 parent f98107b commit 9f9c7de

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/gameobjects/components/Animation.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,9 @@ var Animation = new Class({
507507

508508
/**
509509
* Takes a value between 0 and 1 and uses it to set how far this animation is through playback.
510-
* Does not factor in repeats or yoyos.
510+
* Does not factor in repeats or yoyos, but does handle playing forwards or backwards.
511511
*
512512
* @method Phaser.GameObjects.Components.Animation#setProgress
513-
* @todo
514513
* @since 3.4.0
515514
*
516515
* @param {float} [value=0] - [description]
@@ -519,6 +518,13 @@ var Animation = new Class({
519518
*/
520519
setProgress: function (value)
521520
{
521+
if (!this.forward)
522+
{
523+
value = 1 - value;
524+
}
525+
526+
this.setCurrentFrame(this.animationManager.getFrameByProgress(value));
527+
522528
return this.parent;
523529
},
524530

0 commit comments

Comments
 (0)