SpriteSheet class

A grid measured over an image, and the pieces you can take from it.

A sheet is coordinates only; the rows it hands back hold the animation state.

    0              128
  0 +---+---+---+---+
    | 0 | 1 | 2 | 3 |
    +---+---+---+---+
    | 0 | 1 | 2 | 3 |
 64 +---+---+---+---+
final sheet = SpriteSheet('assets/slime.png', .all(56));

sheet.image(row: 0, column: 3);
sheet.animation(row: 1, end: 30, fps: 24);
sheet.animations(fps: 16, rows: [.new(end: 14), .new(end: 30)]);

Constructors

SpriteSheet(String asset, Vector2 cell)
Measures a grid of cell frames over the image cached at asset.

Properties

asset → String
The cache key the grid is measured over.
final
cell → Vector2
The size of one frame.
final
columns → int
How many columns of frames the grid holds.
no setter
hashCode → int
The hash code for this object.
no setterinherited
rows → int
How many rows of frames the grid holds.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

animation({int? row, int? start, int? end, required double fps, bool? loop}) → SpriteAnimation
One row of the grid, or a span of one, played at fps.
animations({required double fps, bool? loop, List<SheetRow>? rows}) → SpriteGroup
Every row of the grid, played as rows says, end to end.
image({int? row, int? column}) → SpriteImage
One frame of the grid, drawn still.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
timed(List<double> durations, {int? row, int? start, bool? loop}) → SpriteAnimation
One row of the grid, holding each frame for its own number of seconds.
toString() → String
A string representation of this object.
inherited

Operators

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