simvx.core.animation.player¶
AnimationPlayer – timeline-based animation playback node.
Module Contents¶
Classes¶
Plays timeline-based animation clips on a target node. |
API¶
- class simvx.core.animation.player.AnimationPlayer(target=None, skeleton=None, **kwargs)[source]¶
Bases:
simvx.core.node.NodePlays timeline-based animation clips on a target node.
As a Node subclass, it participates in the scene tree and gets
process(dt)called automatically. By default it animates its parent.Supports crossfading between clips, firing track events, and skeletal animation via
SkeletalAnimationClip+Skeleton.Attributes: target: The node whose properties are animated. Defaults to
parentif not set explicitly. clips: Dictionary of registeredAnimationClipobjects keyed by name. skeletal_clips: Dictionary ofSkeletalAnimationClipobjects keyed by name. skeleton: OptionalSkeletonnode for bone-track playback. current_clip: Name of the currently playing clip, orNone. current_time: Playback position within the current clip (seconds). playing: Whether playback is active. speed_scale: Playback speed multiplier (1.0 = normal). loop: Whether the current clip should loop when finished. animation_finished: Signal emitted when a non-looping clip ends.Example::
player = AnimationPlayer() player.add_clip(jump_clip) player.add_clip(run_clip) player.play("jump") player.crossfade("run", duration=0.3) # Skeletal animation: player.skeleton = skeleton_node player.add_skeletal_clip(walk_skeletal_clip) player.play("walk", loop=True)Initialization
- add_clip(clip: simvx.core.animation.track.AnimationClip | simvx.core.animation.skeletal.SkeletalAnimationClip)[source]¶
Register an animation clip (property-based or skeletal).
- add_skeletal_clip(clip: simvx.core.animation.skeletal.SkeletalAnimationClip)[source]¶
Register a skeletal animation clip.
- play(clip_name: str, loop: bool = False)[source]¶
Play animation clip, cancelling any active crossfade.
- crossfade(clip_name: str, duration: float = 0.3)[source]¶
Blend from the current clip to a new clip over duration seconds.
If no clip is playing or the target clip is unknown, falls back to
play().
- strict_errors: ClassVar[bool]¶
True
- script_error_raised¶
‘Signal(…)’
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- property process_mode: simvx.core.descriptors.ProcessMode¶
- reset_error() None¶
- add_child(node: simvx.core.node.Node) simvx.core.node.Node¶
- remove_child(node: simvx.core.node.Node)¶
- reparent(new_parent: simvx.core.node.Node)¶
- get_node(path: str) simvx.core.node.Node¶
- find_child(name: str, recursive: bool = False) simvx.core.node.Node | None¶
- find(node_type: type, recursive: bool = True) simvx.core.node.Node | None¶
- property path: str¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- ready() None¶
- enter_tree() None¶
- exit_tree() None¶
- physics_process(dt: float) None¶
- draw(renderer) None¶
- input_event(event: simvx.core.events.InputEvent) None¶
- input(event: simvx.core.events.TreeInputEvent) None¶
- unhandled_input(event: simvx.core.events.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- clear_children()¶
- destroy()¶
- property app¶
- property tree: simvx.core.scene_tree.SceneTree¶
- get_tree() simvx.core.scene_tree.SceneTree¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.descriptors.Property]¶
- __repr__()¶