Animation
Overview
Animation data in this library is organized as a Scene-level AnimationClip, which contains one or more AnimationNode objects, each binding a property on a scene object to a KeyframeSequence through a BindPoint. This object model is implemented in this fork (none of these classes appear in the not-implemented list) — the construction path below uses only the method signatures actually present in the public API surface.
The animation object model
A Scene can hold multiple named AnimationClip objects. Each clip tracks its own start/stop range and a list of AnimationNode entries:
from aspose.threed import Scene
scene = Scene()
clip = scene.create_animation_clip("Bounce")
anim_node = clip.create_animation_node("Ball")scene.animation_clips lists every clip on the scene; scene.current_animation_clip is whichever clip is considered active. AnimationClip.start and AnimationClip.stop mark the clip’s playback range.
Binding a property to a keyframe sequence
An AnimationNode associates an animatable object and one of its properties with a BindPoint, which in turn owns one or more named KeyframeSequence objects:
from aspose.threed import Scene
scene = Scene()
ball_node = scene.root_node.create_child_node("Ball")
clip = scene.create_animation_clip("Bounce")
anim_node = clip.create_animation_node("Ball")
bind_point = anim_node.create_bind_point(ball_node.transform, "translation")
sequence = bind_point.create_keyframe_sequence("translation_y")create_bind_point(obj, prop_name) takes the object being animated — here, the Node’s Transform — and the name of the property on it; create_keyframe_sequence(name) creates a named KeyframeSequence under that bind point.
Adding keyframes
KeyframeSequence.add(time, value, interpolation) appends one keyframe at a time:
from aspose.threed.utilities import Interpolation
sequence.add(0.0, 0.0, Interpolation.LINEAR)
sequence.add(0.5, 2.0, Interpolation.LINEAR)
sequence.add(1.0, 0.0, Interpolation.LINEAR)sequence.key_frames lists every KeyFrame added so far — each KeyFrame carries time, value, and interpolation, plus tangent fields for the spline interpolation modes (BEZIER, B_SPLINE, CARDINAL_SPLINE, TCB_SPLINE). sequence.pre_behavior and sequence.post_behavior (each an Extrapolation) control what happens before the first and after the last keyframe.
Tips and Best Practices
- Use Interpolation.LINEAR unless you specifically need eased or spline motion — it is the simplest to reason about and the safest default.
- Keep keyframe times in ascending order as you add them; KeyframeSequence.add() does not reorder existing keyframes for you.
- Read back sequence.key_frames after building a sequence to confirm the values you intended were actually stored before exporting.
- Scope one AnimationNode per animated property rather than reusing a single node for unrelated properties — it keeps each clip’s structure easy to follow.
Common Issues
| Issue | Cause | Fix |
|---|---|---|
| AnimationClip has no visible effect after export | The target format’s exporter does not carry animation data through (FBX export in particular is not implemented in this fork at all) | Confirm the target format and exporter actually serialize animation before relying on it |
| Keyframes appear out of order | Keyframes were added with non-increasing time values | Add keyframes in ascending time order |
| Playback range looks wrong | AnimationClip.start / .stop were left at their defaults | Set start and stop explicitly to the range your keyframes actually cover |
FAQ
Is the keyframe animation object model actually implemented, or just declared in the API?
AnimationClip, AnimationNode, BindPoint, and KeyframeSequence are all absent from this fork’s not-implemented list, unlike the render module or FbxExporter — the methods documented on this page are real, callable methods, not stubs.
Can one AnimationClip drive more than one property?
Yes — create more than one AnimationNode (or more than one bind point/sequence pair) under the same clip, one per animated property.
Does exporting to glTF preserve animation data?
Check the specific exporter’s save options and test the round trip for your target format before relying on it; this page documents the in-memory object model, not every exporter’s format-level animation support.
API Reference Summary
| Class/Method | Description |
|---|---|
| Scene.create_animation_clip(name) | Create a named AnimationClip on the scene |
| AnimationClip.create_animation_node(node_name) | Add an AnimationNode to the clip |
| AnimationNode.create_bind_point(obj, prop_name) | Bind an object’s property for animation |
| BindPoint.create_keyframe_sequence(name) | Create a named KeyframeSequence under a bind point |
| KeyframeSequence.add(time, value, interpolation) | Append one keyframe |
| KeyframeSequence.key_frames | The KeyFrame list added so far |