simvx.core.animation.player¶
AnimationPlayer – timeline-based animation playback node.
Module Contents¶
Classes¶
Plays timeline-based animation clips on a target node. |
Data¶
API¶
- simvx.core.animation.player.log¶
‘getLogger(…)’
- class simvx.core.animation.player.AnimationPlayer(**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
on_update(dt)called automatically. By default it animates its parent.Supports crossfading between clips, firing track events, and skeletal animation via
SkeletalAnimationClip+Skeleton.Properties: target: The node whose properties are animated. Defaults to
parentif not set explicitly. skeleton: OptionalSkeletonnode for bone-track playback. Only a 3DSkeleton(orNone) is accepted; see :class:_SkeletonProperty. playing: Whether playback is active. speed_scale: Playback speed multiplier (1.0 = normal). loop: Whether the current clip should loop when finished.Attributes: clips: Dictionary of registered
AnimationClipobjects keyed by name. skeletal_clips: Dictionary ofSkeletalAnimationClipobjects keyed by name. current_clip: Name of the currently playing clip, orNone. current_time: Playhead position within the current clip, in seconds. Playback state rather than authoring state, so it is transient: a scene saved mid-clip reloads at the start of that clip, not at whatever second the save happened to catch. Move it with :meth:seek. 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_clip(walk_skeletal_clip) player.play("walk", loop=True)Initialization
- target¶
‘Property(…)’
- skeleton¶
‘_SkeletonProperty(…)’
- playing¶
‘Property(…)’
- speed_scale¶
‘Property(…)’
- loop¶
‘Property(…)’
- __transient__¶
‘frozenset(…)’
- add_clip(clip: simvx.core.animation.track.AnimationClip | simvx.core.animation.skeletal.SkeletalAnimationClip)[source]¶
Register an animation clip (property-based or skeletal).
- 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.
A clip that is still playing keeps playing as it fades out. A non-looping clip that has already run to its end holds its final pose for the length of the blend instead of the player snapping straight onto the incoming clip, so crossfading out of a one-shot that has just finished blends the way an author expects.
Falls back to
play()when there is nothing to blend from: no clip has been played, playback was stopped or paused part-way through, or clip_name is not registered.
- stop()[source]¶
Stop playback and reset to the start of the current clip.
playingbecomesFalse, the playhead resets tocurrent_time = 0, and any crossfade in progress is cancelled.
- pause()[source]¶
Pause playback, preserving the playhead.
playingbecomesFalsebutcurrent_timeis left untouched;resume()continues from where playback left off.
- strict_errors: ClassVar[bool]¶
True
- dev_checks: ClassVar[bool]¶
None
- script_error_raised¶
‘Signal(…)’
- dynamic: bool¶
False
- visible¶
‘Property(…)’
- update_mode¶
‘Property(…)’
- __properties__: ClassVar[dict[str, simvx.core.descriptors.Property]]¶
None
- classmethod __init_subclass__(**kwargs)¶
- property name: str¶
- property visible_in_tree: bool¶
- reset_error() None¶
- add_child(node: simvx.core.node.T) simvx.core.node.T¶
- remove_child(node: simvx.core.node.Node) None¶
- reparent(new_parent: simvx.core.node.Node)¶
- node_at(path, default=_NO_DEFAULT)¶
- find(target, *, direct: bool = False)¶
- find_all(target, *, direct: bool = False)¶
- expect(target, *, direct: bool = False)¶
- ancestor(target)¶
- walk(*, include_self: bool = True) collections.abc.Iterator[simvx.core.node.Node]¶
- property path: str¶
- property is_scene_root: bool¶
- add_to_group(group: str)¶
- remove_from_group(group: str)¶
- is_in_group(group: str) bool¶
- on_ready() None¶
- on_enter_tree() None¶
- on_exit_tree() None¶
- on_fixed_update(dt: float) None¶
- on_draw(renderer) None¶
- on_picked(event: simvx.core.events.InputEvent) None¶
- on_unhandled_input(event: simvx.core.events.TreeInputEvent) None¶
- start_coroutine(gen: simvx.core.descriptors.Coroutine) simvx.core.descriptors.CoroutineHandle¶
- stop_coroutine(gen_or_handle)¶
- queue_redraw() None¶
- property render_dirty: bool¶
- clear_children()¶
- destroy()¶
- property destroying: bool¶
- call_deferred(method: collections.abc.Callable[..., Any], *args: Any) None¶
- property app¶
- property tree: simvx.core.scene_tree.SceneTree¶
- property physics¶
- property physics_2d¶
- __getitem__(key: str)¶
- classmethod get_properties() dict[str, simvx.core.descriptors.Property]¶
- __repr__()¶