SpriteAnimation.addFrame - HermesPasser/Ramu GitHub Wiki

SpriteAnimation.addFrame()

Parameters

Image Object\Image Object[] img: Image or image array to be added as frames to the animation.

Description

Add an animation frame.

You can test this snippet of code here.

let f1 = "https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_1.gif";
let f2 = "https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_2.gif";
let f3 = "https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_3.gif";
let f4 = "https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_4.gif";
let f5 = "https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSprite_5.gif";

let anim = new SpriteAnimation(10, 10, 35, 35);
anim.addFrame(Ramu.Utils.getImage(f1));
anim.addFrame(Ramu.Utils.getImage(f2));
anim.addFrame(Ramu.Utils.getImage(f3));
anim.addFrame([
   Ramu.Utils.getImage(f4),
   Ramu.Utils.getImage(f5)
]);