Skylicht Engine
Loading...
Searching...
No Matches
Skylicht::CAnimationTimeline Class Reference

Manages the playback state of an animation (current time, speed, loop state). More...

#include <Animation/Skeleton/CAnimationTimeline.h>

Public Member Functions

void update ()
 Updates the current frame based on time step and speed.
void play (bool fromBegin=true)
 Starts or resumes playback.
float getAnimDuration ()
 Gets the duration of the current playback range (To - From).
float getClipDuration ()
 Gets the total duration of the source animation clip.
bool isEnd ()
 Checks if the animation has reached or passed the 'To' frame.

Public Attributes

float From
 Start frame of the playback range in seconds.
float To
 End frame of the playback range in seconds.
float Duration
 Total duration of the animation clip in seconds.
float Frame
 Current playback position in seconds.
float Speed
 Playback speed multiplier (default: 1.0).
float Weight
 Blending weight for this timeline (0 to 1).
bool Loop
 Whether the animation should restart when it reaches the 'To' frame.
bool Pause
 Whether playback is currently paused.

Detailed Description

Manages the playback state of an animation (current time, speed, loop state).

Example: Controlling playback

CAnimationTimeline& timeline = skeleton->getTimeline();
timeline.Speed = 1.5f; // Play faster
timeline.Loop = false; // Play once
timeline.Pause = true; // Pause
if (timeline.isEnd())
os::Printer::log("Animation finished!");
float Speed
Playback speed multiplier (default: 1.0).
Definition CAnimationTimeline.h:60
bool Pause
Whether playback is currently paused.
Definition CAnimationTimeline.h:69
bool Loop
Whether the animation should restart when it reaches the 'To' frame.
Definition CAnimationTimeline.h:66
bool isEnd()
Checks if the animation has reached or passed the 'To' frame.

Member Function Documentation

◆ getAnimDuration()

float Skylicht::CAnimationTimeline::getAnimDuration ( )
inline

Gets the duration of the current playback range (To - From).

Returns
Range duration in seconds.

◆ getClipDuration()

float Skylicht::CAnimationTimeline::getClipDuration ( )
inline

Gets the total duration of the source animation clip.

Returns
Clip duration in seconds.

◆ isEnd()

bool Skylicht::CAnimationTimeline::isEnd ( )

Checks if the animation has reached or passed the 'To' frame.

Returns
True if at the end.

◆ play()

void Skylicht::CAnimationTimeline::play ( bool fromBegin = true)

Starts or resumes playback.

Parameters
fromBeginIf true, resets Frame to the 'From' position.

The documentation for this class was generated from the following file: