SpriteAnimation class

Sprite animation for frame-based animations

Inheritance

Constructors

SpriteAnimation({required Sprite sprite, required List<Rect> frames, required double duration, bool loop = true, VoidCallback? onComplete})
Create a sprite animation

Properties

currentFrame int
Current frame index
getter/setter pair
currentTime double
Current time in the animation
getter/setter pairinherited
duration double
Animation duration
finalinherited
frames List<Rect>
List of frame rectangles from sprite sheet
final
hashCode int
The hash code for this object.
no setterinherited
isComplete bool
Check if animation is complete
no setterinherited
isPaused bool
Whether animation is paused
getter/setter pairinherited
loop bool
Whether animation loops
finalinherited
normalizedTime double
Get normalized time (0.0 to 1.0)
no setterinherited
onComplete VoidCallback?
Callback when animation completes
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
speed double
Animation speed multiplier
getter/setter pairinherited
sprite Sprite
The sprite to animate
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
Pause the animation
inherited
play() → void
Play the animation
inherited
reset() → void
Reset the animation
inherited
stop() → void
Stop and reset
inherited
toString() String
A string representation of this object.
inherited
update(double deltaTime) → void
Update the animation
inherited
updateAnimation(double deltaTime) → void
Override this to implement animation logic
override

Operators

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

Static Methods

fromSpriteSheet({required Sprite sprite, required int frameCount, required int frameWidth, required int frameHeight, required double duration, int startFrame = 0, bool loop = true}) SpriteAnimation
Create from sprite sheet