SpriteAnimation class
A run of frames, played.
The plain constructor is for art that ships one file per animation:
final idle = SpriteAnimation('assets/slime_idle.png', .all(56), fps: 16);
This kind of sprite is frequently obtained via SpriteSheet.animation, which can cut up a single image into any number of animations.
Constructors
- SpriteAnimation(String asset, Vector2 size, {int? row, int? start, int? end, required double fps, bool? loop})
-
Cuts the image cached at
assetintosizeframes and plays them.factory - SpriteAnimation.of(SpriteRegion region, {required double fps, bool? loop})
-
Plays
regionatfps, holding every frame for the same length of time.factory -
SpriteAnimation.timed(String asset, Vector2 size, List<
double> durations, {int? row, int? start, bool? loop}) -
Cuts the image cached at
assetintosizeframes, each held for its own number of seconds.factory -
SpriteAnimation.timedOf(SpriteRegion region, List<
double> durations, {bool? loop}) -
Plays
region, holding each frame for its own number of seconds.factory
Properties
-
entries
→ List<
SpriteEntry< int> > -
What this holds, in the order its entries are numbered.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- region → SpriteRegion
-
Which piece of which asset this plays.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reload(
) → Sprite< int> -
Re-resolves this sprite against Ignis.cache.
override
-
resolve(
int key) → SpriteEntry< int> ? -
The entry
keynames, or null where nothing here answers to it.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited