SpriteFrame class

A single frame within a spritesheet.

Describes the rectangular region of the source image that contains this frame's pixel data, plus optional duration and trimming info.

Constructors

SpriteFrame({required Rect rect, int? duration, Size? sourceSize, Offset offset = Offset.zero, bool rotated = false, bool trimmed = false})
Creates a sprite frame.
const

Properties

duration → int?
Duration of this frame in milliseconds. Overrides global FPS when set.
final
hashCode → int
The hash code for this object.
no setteroverride
height → double
The display height of this frame (accounts for rotation).
no setter
offset → Offset
Offset from the top-left of the source size to the trimmed rect.
final
rect → Rect
The rectangle region within the spritesheet image.
final
rotated → bool
Whether this frame is rotated 90 degrees clockwise in the atlas.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sourceSize → Size?
Original size before trimming. Used for proper positioning.
final
trimmed → bool
Whether this frame has been trimmed from its original size.
final
width → double
The display width of this frame (accounts for rotation).
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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