Skip to content

Ariadne: keyframe animation, a scene's animations: - #1515

Merged
transfix merged 8 commits into
masterfrom
scene/animations
Nov 24, 2026
Merged

transfix merged 8 commits into
masterfrom
scene/animations

Conversation

@transfix

Copy link
Copy Markdown
Owner

A scene can now animate its nodes along keyframes. Before this, anything that moved needed a program writing keys every frame, physics, or a custom node type; there was no way to say "the door swings open over two seconds". This is item 7 of the Ariadne scene-format gap plan.

scene:
  animations:
    - animation: door_open        # its keys: animations.door_open.time / .playing / .speed
      tracks:
        - node: door
          key: rotation
          interpolation: smooth
          keys: [[0, [0, 0, 0]], [1.5, [0, 0, 95]], [2, [0, 0, 90]]]
    - animation: beacon
      loop: true                  # false (the default) | true | pingpong
      tracks:
        - { node: beacon, key: color, keys: [[0, [1, 0.2, 0]], [0.5, [1, 0.8, 0]], [1, [1, 0.2, 0]]] }
        - { state: beacon.level, keys: [[0, 0], [0.5, 1], [1, 0]] }
    - animation: wave
      loop: pingpong
      autoplay: false
      tracks:
        - { node: flag, key: position, keys: [[0, [0, 0, 0]], [1, [0, 0, 0.4]]] }

How it works

  • A track moves one thing along keys: [[seconds, value], ...].
    • A node track names node: <id> and a key:: position, rotation, scale, color, opacity or visible. The id names every node that has it, such as each repeat: copy's child; a path, post_3/flag, names one.
    • A state track, state: <path>, writes its value to that key, resolved as a bind is.
    • interpolation: is linear, step, or smooth (a cubic Hermite with Catmull-Rom tangents, flat at the ends).
    • Rotation interpolates each Euler angle on its own, so [0, 0, 360] is a whole turn. Item 2's decision stands: no quaternions until something needs them.
  • An animation lasts until its latest key (or duration:). At the end it stops, loops or turns back (loop: false | true | pingpong). speed: can be below 0 to play backwards, and autoplay: false waits.
  • Its keys, <prefix>.animations.<id>.time, .playing and .speed, are written as it plays and read every frame. So a program seeks, plays, pauses or changes the speed with state-set. A once animation played again after its end starts over.
  • The clock. An animated scene runs on the scene clock (as clock: {} would), and animations read its time between quanta. So sim_transport's Paused and Speed hold and slow animations along with physics.
  • At realize every animation sets its start pose, playing or not.

Changes

  • New inc/cvc/ariadne/scene_animation.h / src/cvc/ariadne/scene_animation.cpp, with no renderer: SceneAnimation, SceneAnimationTrack, sample_track, advance_animation, node_key_width.
  • Loader: parse_scene_animations puts keyframes in time order. A track naming neither or both of node: and state:, a node key nothing can move, or keyframes of mixed width is left out with a warning. An animation id must be a key segment.
  • Realizer:
    • RealizedScene::animations holds a SceneAnimationBinding per animation: its playhead, its kept state keys, and its targets, found again when the scene's nodes change.
    • realize_animations sets the start pose and turns the clock on.
    • tick_scene_animations runs in tick_scene after physics and clip sync, before the custom tickers.
    • Values are written only when they change (state keys compare the text written last, so a script's write is told apart from the animation's own).
  • ARIADNE.md §5.4: an "Animations" paragraph after repeat:.

Tests

  • ariadne_loader_test:
    • AnimationsParsed: every key; keyframes put in time order; four bad tracks (an unknown key, the wrong width, both node and state, mixed widths) and a bad id left out with warnings.
    • AnimationTrackSampling: the ends hold; linear, step and smooth between keys; smoothstep for a two-key smooth track.
    • AnimationPlayback: once stops at either end, including backwards; loop wraps both ways; pingpong turns back; a zero-length animation holds.
  • New cvcgl_ariadne_animation, headless realize_scene and tick_scene stepping the clock 0.05 s a frame (under its 8-quanta cap), 23 checks:
    • Start: the start pose and keys at realize.
    • Once: a linear rotation and a step position over half a second, ending at the last key with playing 0.
    • Loop: a colour and a state key.
    • Pingpong: a paused pingpong played by writing its key, moving both repeat: copies' flags while a path scales one.
    • Script control: a seek, play, play-again-after-end restarting from 0, pause, speed 2.
    • Paused clock: holds everything.

Verified locally

Windows, MSVC, with cvcGL (no examples, no pycvc). The full ctest suite, 8,556 tests at -j 10, on master 8d27f6a (#1464):

  • Pass: everything but four.
  • Already failing here: cvcgl_contour_lab and cvcgl_volume_grid_contours (this build has no cvc::planar), and cvcgl_ari_golden, whose seven goldens have the same pixel counts as master.
  • Load: StateClusterMembership.FailureDetectionEvict failed under load and passes alone.

After merging #1491 (7337df6): the docs conflict only.

  • ariadne_loader_test: 266 pass.
  • cvcgl_ariadne_animation: 23/23.
  • cvcgl_ariadne_node_pick: 23/23.
  • cvcgl_ariadne_repeat: 40/40.

With the JSON-schema validator built in: ariadne_schema_test passes 13 (one skip, the without-validator case), and cvcgl_ariadne_animation's document passes ari validate.

Not verified: Linux, macOS, wasm and pycvc.

Schema

#1464 (the closed schema, which every load checks) is on master, so this PR adds its own keys: $defs/animation and $defs/animation_track, and animations in both scene definitions (scene: and a scenes: entry).

Not done

  • Imported animation (glTF channels, skins, morph targets): item 8.
  • Camera tracks: a camera's pose is the CameraController's state; a state: track can drive its keys meanwhile.
  • Events at keyframes (an on_end: program).

A scene's `animations:` moves its nodes (position, rotation, scale, color,
opacity, visible) or writes state keys along keyframes over the scene clock:
linear, step or smooth (cubic Hermite, Catmull-Rom tangents, flat at the ends)
between keys; once, loop or pingpong at the end; a speed (below 0,
backwards) and autoplay. A node id names every node with it (each repeat:
copy's child), a path a/b one. Each animation's <prefix>.animations.<id>.time,
.playing and .speed are written as it plays and read each frame, so a script
seeks, plays, pauses and changes its speed. An animated scene runs on the
scene clock, as clock: {} would make it. Gap item 7 of the scene-format plan.

- New inc/cvc/ariadne/scene_animation.h / src/cvc/ariadne/scene_animation.cpp:
  SceneAnimation, SceneAnimationTrack, sample_track, advance_animation,
  node_key_width (no renderer).
- Loader: parse_scene_animations; bad tracks left out with a warning.
- Realizer: RealizedScene::animations (SceneAnimationBinding), realize_animations
  (start pose, clock on), tick_scene_animations in tick_scene after physics and
  clip sync.
- docs/ARIADNE.md §5.4 "Animations".
- Tests: ariadne_loader_test AnimationsParsed, AnimationTrackSampling,
  AnimationPlayback; cvcgl_ariadne_animation.
The closed schema (#1464, now on master) gains $defs/animation and
$defs/animation_track, and animations: in both scene definitions (scene: and a
scenes: entry). Checked with the validator built in: ariadne_schema_test 13
(one skip), ariadne_loader_test 265, and cvcgl_ariadne_animation's document
validates.
docs/ARIADNE.md conflicted where this branch adds the Animations paragraph and
#1491 its Picking a node paragraph at the same place in §5.4: both kept.
…ment

# Conflicts:
#	src/cvc/ariadne/schema/ari.v1.schema.json
#	src/cvc/tests/ariadne_loader_test.cpp
#	src/cvcGL/ariadne/scene_realize.cpp
# Conflicts:
#	src/cvc/CMakeLists.txt
@transfix
transfix merged commit 92fa424 into master Nov 24, 2026
30 checks passed
@transfix
transfix deleted the scene/animations branch November 24, 2026 16:52
transfix added a commit that referenced this pull request Nov 24, 2026
…hers

# Conflicts:
#	src/cvc/tests/ariadne_loader_test.cpp
#	src/cvcGL/CMakeLists.txt
transfix added a commit that referenced this pull request Nov 24, 2026
…, and others

# Conflicts:
#	docs/ARIADNE.md
#	inc/cvc/ariadne/scene_animation.h
#	src/cvc/ariadne/loader.cpp
#	src/cvc/ariadne/schema/ari.v1.schema.json
#	src/cvc/tests/ariadne_loader_test.cpp
#	src/cvcGL/CMakeLists.txt
#	src/cvcGL/ariadne/scene_realize.cpp
transfix added a commit that referenced this pull request Nov 24, 2026
Conflicts: src/cvcGL/CMakeLists.txt's 8 MB-stack list keeps both sides'
tests; volume_grid, volume_grid_contours and volume_grid_quad take master's
images (#1452 changed their documents) until CI's frames of the merge are
taken.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant