Sprite<T> class abstract

The frames a SpriteNode draws, and how long each is held.

Three implementations ship: a SpriteImage is one image, a SpriteSheet cuts an image into a grid, and a SpriteGroup lays several of either end to end. Implement this to draw frames packed some other way.

A row is the unit. Everything but rows answers for one, so an implementation is free to hold every row in its own image, at its own size.

T is what rows are named with, where they are named at all: an enum, a String, anything with an ==. Every sprite composed with another shares its key type, so rowOf answers for the whole tree.

Implementers

Constructors

Sprite()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
rows int
How many rows of frames this holds.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

duration(int row, int index) double
How long frame index of row is held, in seconds.
frames(int row) int
How many frames row plays.
image(int row) Image
The image row is drawn from.
loops(int row) bool
Whether row starts over after its last frame.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rect(int row, int index) Rect
Where frame index of row sits in image.
reload() Sprite<T>
Re-resolves this sprite against Ignis.cache.
rowOf(T key) int?
The row key names, or null where nothing here answers to it.
size(int row) Vector2
The size of one frame of row, which a SpriteNode takes as its own.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited