Skip to content

SpritesheetAnimation.addFrame

Douglas Lacerda edited this page Sep 3, 2018 · 1 revision

SpritesheetAnimation.addFrame()

Parameters

Rect\Rect[] rect: Rect or rect array that represents the sheet of the image to be added as frame.

Description

Add an animation frame.

You can test this snippet of code here.

let img = Ramu.Utils.getImage("https://raw.githubusercontent.com/HermesPasser/Ramu/master/demos/img/anim/crossSheet.gif");
let anim = new SpritesheetAnimation(img, 10, 10, 35, 35);
anim.addFrame(new Rect(43, 52, 35, 35));
anim.addFrame(new Rect(3, 52, 35, 35));
anim.addFrame(new Rect(83, 2, 35, 35));
anim.addFrame([
  new Rect(43, 2, 35, 35),
  new Rect(3, 2, 35, 35)
]);
Clone this wiki locally