Class Animation
Defined in File sprite.h
Class Documentation
-
class Animation
Declaration:
finalIndependent cursor retaining shared immutable clip metadata, even after its CE::Assets::Sprites::Asset is released.
Copies copy playback state without retaining GPU handles. Advance on its simulation owner, then publish cell(); mutation is unsynchronized.
Public Functions
-
Animation &operator[](std::size_t frame)
Select a clip-frame ordinal via set_frame(), resetting within-frame time.
See also
- Returns:
This mutable cursor, not a new sprite or grid-cell view.
-
void set_frame(std::size_t frame)
Select a clip ordinal and reset elapsed time inside it.
See also
- Parameters:
frame – Ordinal; looping clips wrap, nonlooping clips clamp to their last frame. Mutation is unsynchronized and belongs to the simulation owner.
-
void advance(std::chrono::duration<double> elapsed)
Advance this independent cursor using simulation seconds.
See also
- Parameters:
elapsed – Finite nonnegative duration; invalid values throw invalid_args before changing playback. Exact duration boundaries advance to the next frame; loops wrap efficiently and nonlooping clips hold the final frame. This does not update a shared asset, GPU handle or wall clock.
-
inline std::size_t index() const
Declaration:
[[nodiscard]]Read the current clip-frame ordinal, distinct from the selected grid cell.
See also
-
CE::Assets::Grids::CellIndex cell() const
Declaration:
[[nodiscard]]Read the current clip frame’s row-major grid cell for draw submission.
See also
-
inline const Clip &definition() const
Declaration:
[[nodiscard]]Borrow immutable clip metadata retained by this cursor.
The cursor keeps the CPU snapshot alive even after its source Asset is released; no GPU handles are retained by the cursor.
See also
-
std::chrono::milliseconds frame_duration() const
Declaration:
[[nodiscard]]Read the selected frame’s positive duration in milliseconds; this does not advance playback.
See also
-
inline bool loops() const
Declaration:
[[nodiscard]]Read whether this clip repeats rather than holding its last frame.
See also
-
Animation &operator[](std::size_t frame)