SpriteAnimation class
Represents a sprite animation, that is, a list of sprites that change with time.
Constructors
-
SpriteAnimation(List<
SpriteAnimationFrame> frames, {bool loop = true}) -
SpriteAnimation.fromAsepriteData(Image image, Map<
String, dynamic> jsonData) -
Automatically creates an Animation Object using animation data provided by
the json file provided by Aseprite.
factory
- SpriteAnimation.fromFrameData(Image image, SpriteAnimationData data)
-
Create animation from a single
image
that contains all frames.factory -
SpriteAnimation.spriteList(List<
Sprite> sprites, {required double stepTime, bool loop = true}) -
Create animation from a list of
sprites
all having the same transition timestepTime
.factory -
SpriteAnimation.variableSpriteList(List<
Sprite> sprites, {required List<double> stepTimes, bool loop = true}) -
Create animation from a list of
sprites
each having its own duration provided in thestepTimes
list.factory
Properties
-
frames
↔ List<
SpriteAnimationFrame> -
The frames that compose this animation.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- loop ↔ bool
-
Whether the animation loops after the last sprite of the list, going back
to the first, or keeps returning the last when done.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stepTime ← double
-
Sets a fixed step time to all frames.
no getter
-
variableStepTimes
← List<
double> -
Sets a different step time to each frame.
The sizes of the arrays must match.
no getter
Methods
-
clone(
) → SpriteAnimation - Returns a new Animation equal to this one in definition, but each copy can be run independently.
-
createTicker(
) → SpriteAnimationTicker - Creates and returns a new SpriteAnimationTicker.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reversed(
) → SpriteAnimation - Returns a new Animation based on this animation, but with its frames in reversed order
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
load(
String src, SpriteAnimationData data, {Images? images}) → Future< SpriteAnimation> -
Takes a path of an image, a SpriteAnimationData and loads the sprite
animation.
When the
images
is omitted, the global Flame.images is used.