simvx.core.animation.track

Keyframe animation tracks and clips.

Module Contents

Classes

AnimationEvent

Event that fires when playback crosses a specific timestamp.

Track

Property animation track with keyframe interpolation.

AnimationClip

Timeline-based animation with multiple property tracks.

Data

log

API

simvx.core.animation.track.log[source]

‘getLogger(…)’

class simvx.core.animation.track.AnimationEvent[source]

Event that fires when playback crosses a specific timestamp.

Attributes: time: Timestamp in seconds when the event fires. callback: Function to call when the event triggers. args: Positional arguments passed to callback.

time: float

None

callback: collections.abc.Callable

None

args: tuple

()

class simvx.core.animation.track.Track(property_name: str)[source]

Property animation track with keyframe interpolation.

Stores (time, value) keyframes and interpolates between them. Optionally holds AnimationEvents that fire when playback crosses their timestamp.

Initialization

add_keyframe(time: float, value: Any)[source]

Add keyframe at given time.

add_event(time: float, callback: collections.abc.Callable, *args)[source]

Add an event that fires when playback crosses the given timestamp.

Args: time: Timestamp in seconds. callback: Function to invoke. *args: Additional arguments forwarded to callback.

fire_events(prev_time: float, cur_time: float) None[source]

Fire events whose timestamps fall in the half-open interval (prev_time, cur_time].

Args: prev_time: Playback time at previous frame. cur_time: Playback time at current frame.

evaluate(time: float) Any[source]

Evaluate track at given time.

class simvx.core.animation.track.AnimationClip(name: str, duration: float)[source]

Timeline-based animation with multiple property tracks.

Example: clip = AnimationClip(“jump”, duration=1.0) clip.add_track(“position”, [ (0.0, Vec3(0, 0, 0)), (0.5, Vec3(0, 5, 0)), (1.0, Vec3(0, 0, 0)), ]) clip.add_track(“rotation”, [ (0.0, 0.0), (1.0, 360.0), ])

Initialization

add_track(property_name: str, keyframes: list[tuple[float, Any]], easing=ease_linear)[source]

Add property track with keyframes.

evaluate(time: float) dict[str, Any][source]

Evaluate all tracks at given time.

to_dict() dict[source]

Serialize clip.

classmethod from_dict(data: dict)[source]

Deserialize clip.