SpriteAnimation.reset - HermesPasser/Ramu GitHub Wiki

SpriteAnimation.reset()

Description

Reset the animation.

You can test this snippet of code here.

let anim = new SpriteAnimation(10, 10, 35, 35);
anim.playInLoop = false;
anim.addFrame([
   Ramu.Utils.getImage("https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_1.gif"),
   Ramu.Utils.getImage("https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_2.gif"),
]);

new GameObj().update = function(){
   if (keyCode.space in Ramu.lastKeysPressed){
      anim.reset();
   }
};