SpriteSheet<T> class
An image cut into a grid of equally sized frames.
Frames are numbered from the start of their row, and a SpriteNode animates along one row. A 128x64 image with a 32x32 size holds two rows of four:
0 128
0 +---+---+---+---+
| 0 | 1 | 2 | 3 |
+---+---+---+---+
| 0 | 1 | 2 | 3 |
64 +---+---+---+---+
A row plays its whole width at the sheet's fps unless a SheetRow says otherwise:
final sheet = SpriteSheet('assets/fire.png', .new(32, 48), fps: 12);
Constructors
-
SpriteSheet(String asset, Vector2 size, {required num fps, bool? loop, List<
SheetRow< ? rows})T> > -
Cuts the image cached at
assetinto frames of the givensize.factory - SpriteSheet.single(String asset, Vector2 size, {required num fps, T? key, bool? loop})
-
Cuts an image that holds one animation, under the name
key.factory
Properties
- asset → String
-
The cache key this sheet was cut from.
final
- columns ↔ int
-
How many columns of frames the grid holds.
latefinal
- fps → num
-
The rate every row without an SheetRow.fps of its own plays at.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- loop → bool
-
Whether every row without a SheetRow.loop of its own starts over.
final
- rows ↔ int
-
How many rows of frames this holds.
latefinaloverride-getter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
duration(
int row, int index) → double -
How long frame
indexofrowis held, in seconds.override -
frames(
int row) → int -
How many frames
rowplays.override -
image(
int row) → Image -
The image
rowis drawn from.override -
loops(
int row) → bool -
Whether
rowstarts over after its last frame.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rect(
int row, int index) → Rect -
Where frame
indexofrowsits in image.override -
reload(
) → SpriteSheet< T> -
Re-resolves this sprite against Ignis.cache.
override
-
rowOf(
T key) → int? -
The row
keynames, or null where nothing here answers to it.override -
size(
int row) → Vector2 -
The size of one frame of
row, which a SpriteNode takes as its own.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited