LDKKeyFrameAnimationSource
typedef struct LDKKeyFrameAnimationSource{
LDKAssetKeyframeAnimation *animations;
u32 animation_count;
u32 animation_capacity;
i32 current_animation;
bool play_on_start;
bool loop;
float speed;
float time;
bool playing;
bool runtime_started;
bool restart_pending;
}LDKKeyFrameAnimationSource;
ldk_keyframe_animation_source_make_default
Construct the default configuration for an animation source component.
LDK_API LDKKeyFrameAnimationSource ldk_keyframe_animation_source_make_default(void);
Returns
Value with autoplay/loop enabled, speed one and no selected clip.
ldk_keyframe_animation_source_add
Append a live animation asset to an entity animation source.
LDK_API bool ldk_keyframe_animation_source_add(
LDKEntity root,
LDKAssetKeyframeAnimation animation
);
Returns
True if appended. Does not transfer ownership of the asset.
ldk_keyframe_animation_source_remove
Detach an asset at the given index from an animation source.
LDK_API bool ldk_keyframe_animation_source_remove(
LDKEntity root,
u32 index
);
Parameters
LDKEntity root
- Root entity containing the animation source.
u32 index
- Zero-based animation index.
Returns
True if removed. Does not unload the asset.
ldk_keyframe_animation_source_replace
Replace a source animation entry with another live animation asset.
LDK_API bool ldk_keyframe_animation_source_replace(
LDKEntity root,
u32 index,
LDKAssetKeyframeAnimation animation
);
Parameters
LDKEntity root
- Root entity containing the animation source.
u32 index
- Zero-based animation index.
LDKAssetKeyframeAnimation animation
- Live asset handle; remains owned by the asset manager.
Returns
True on success. Replacing the active entry resets playback.
ldk_keyframe_animation_source_set_current
Select the animation index used for subsequent playback.
LDK_API bool ldk_keyframe_animation_source_set_current(
LDKEntity root,
i32 index
);
Parameters
LDKEntity root
- Root entity containing the animation source.
i32 index
- Zero-based animation index.
Returns
True for a valid index. Changing selection resets playback.
ldk_keyframe_animation_source_play
Start or resume the current animation and apply its current pose.
LDK_API bool ldk_keyframe_animation_source_play(LDKEntity root);
Parameters
LDKEntity root
- Root entity containing the animation source.
Returns
True if a live clip is selected and the component is enabled.
ldk_keyframe_animation_source_pause
Pause playback while retaining the current position.
LDK_API void ldk_keyframe_animation_source_pause(LDKEntity root);
Parameters
LDKEntity root
- Root entity containing the animation source.
ldk_keyframe_animation_source_stop
Stop playback, seek to zero and apply the initial pose.
LDK_API void ldk_keyframe_animation_source_stop(LDKEntity root);
Parameters
LDKEntity root
- Root entity containing the animation source.
Returns
Nothing. Does not restore the pre-animation component values.
ldk_keyframe_animation_source_seek
Set playback time and immediately evaluate the new pose without events.
LDK_API bool ldk_keyframe_animation_source_seek(
LDKEntity root,
float time
);
Parameters
LDKEntity root
- Root entity containing the animation source.
float time
- Time in seconds.
Returns
True if a live clip is selected. Time is clamped to its duration.
ldk_keyframe_animation_source_event_handler_set
Set the synchronous global callback for keyframe animation events.
LDK_API void ldk_keyframe_animation_source_event_handler_set(
LDKKeyframeEventFn handler,
void *user
);
Parameters
LDKKeyframeEventFn handler
- Event handler invoked synchronously, or NULL to unregister.
void *user
- Opaque callback context.
Returns
Nothing. Passing NULL disables notifications.
Note: Callbacks may mutate or destroy the source; do not keep event pointers.
ldk_keyframe_animation_source_component_desc
Describe the keyframe animation source component to the ECS.
LDK_API LDKComponentDesc ldk_keyframe_animation_source_component_desc(u32 initial_capacity);
Parameters
u32 initial_capacity
- Initial component storage capacity.
Returns
Component description with Transform as a required component.
ldk_keyframe_animation_source_update_all
Advance enabled animation sources during the engine update.
LDK_API void ldk_keyframe_animation_source_update_all(float delta_time);
Parameters
float delta_time
- Elapsed time in seconds.
Returns
Nothing. Events are dispatched before the render phase.
ldk_keyframe_animation_source_reset_all
Reset runtime playback state for every registered animation source.
LDK_API void ldk_keyframe_animation_source_reset_all(void);
Returns
Nothing. Preserves assigned assets and playback configuration.