toyGraphics / com.anysolo.toyGraphics / AnimationFrames

AnimationFrames

class AnimationFrames

A set of animation frames.

You can load frames from a sprite sheet image or an animated GIF.

Sprite sheet image must be file containing many frames in one image, like a 2D matrix. All frames should have the same width and height. All frames will be numbered from 0, from left to right and from top to bottom.

If you use an animated GIF, every frame of the GIF file will be loaded as a separated frames and numbered from 0.

Constructors

<init>

AnimationFrames(frames: List<Image>)

A set of animation frames.

Properties

frames

val frames: List<Image>

height

val height: Int

numberOfFrames

val numberOfFrames: Int

width

val width: Int

Functions

getFrame

fun getFrame(index: Int): Image

Companion Object Functions

loadFromAnimatedGif

fun loadFromAnimatedGif(filename: String): AnimationFrames

Load frames from the an animated GIF file.

loadFromImageSheet

fun loadFromImageSheet(filename: String, columns: Int, rows: Int): AnimationFrames

Load frames from a sprite sheet file.