AnimatedSprite class

An animated sprite - a list of Frame's which changes over time

Constructors

AnimatedSprite({String? imagePath, required Transform2D transform, List<Frame> frames = const [], int index = 0, double time = 0.0})
AnimatedSprite.fromJson(Map<String, dynamic> json)
parse animation json
factory
AnimatedSprite.fromUniformSpriteSheet({required String imagePath, required IntSize spriteSize, required IntRect atlasBounds, required double frameDuration, required Transform2D transform, Color color = const Color(0x00000000)})
Load an animation from a uniform sprite sheet given size and bounds
factory

Properties

currentFrame → Frame
getter for current frame
no setter
frames List<Frame>
final
hashCode int
The hash code for this object.
no setterinherited
imagePath String?
set if all frames use same image
final
index int
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sprite Sprite
return the current frame + animation transform as a sprite
no setter
time double
getter/setter pair
totalTime double
final
transform Transform2D
getter/setter pair

Methods

findIndex(double time) int
find index for frame given time
loadImages(ImageAssetCache imageAssetCache) Future<AnimatedSprite>
load all images in frames
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
reset time and set index to 0
toString() String
A string representation of this object.
inherited
update(double dt) → void
update time and find new frame index

Operators

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

Static Methods

loadJson(String name, JsonAssetCache jsonAssetCache, ImageAssetCache imageAssetCache) Future<AnimatedSprite>
load animation from json asset and load frame images