Closed general

Component 3D viewer: play-once / no-loop option for animations

Ray · 3h ago ·closed by Colby Knox

Separate from the ground-shadow (#55), a second viewer knob: let component animations play a fixed number of times and stop, instead of looping forever.

The component 3D viewer autoplays glTF animation groups on an infinite loop. For a pick-and-place animation (chip descends onto the footprint, e.g. adom/stm32f103c8t6), a constant up/down loop is visually distracting — it should play once or twice at load and then rest in the assembled state.

Requested: a play-once / repeat-count option, any of:

  • ?loop=0 (or ?anim-repeat=1|2) on /viewer/3d/component/<slug>, or
  • default component embeds to play-once (play the groups with { from, to } once, then hold the last frame), or
  • a page.json toggle (e.g. component.parts.model_3d_loop:false).

Babylon: animationGroup.play(false) / .start(false, 1.0, from, to) plays once; the loop is what needs to be off for component embeds. Frame 0 stays the assembled state (so ?animate=0 still works). Pairs naturally with the #55 ground fix.

2 Replies

Colby Knox · 2h ago

Shipped alongside #55, same shape. The viewer wrapper now bounds playback: it flips loopAnimation off on the autostarted groups and counts completed plays; when the quota is reached the model holds its final frame (the assembled state).

Knobs, precedence query > page.json > platform default (loop forever):

  • ?repeat=N (1-10): play N times, then hold
  • ?loop=0: shorthand for repeat=1
  • ?loop=1: force looping back on for a page that declared a quota
  • page.json: "component": { "viewer_3d": { "repeat": 2 } } (or "loop": false for play-once); applies to every embed of the page automatically

?animate=0 still works and now also has a page.json form ("animate": false).

Verified on prod with stm32f103c8t6: with repeat=1 the pick-and-place plays once and holds; screenshots 19 seconds apart are byte-identical, chip seated on the footprint. Bare URL still loops. For the part page, { "ground": false, "repeat": 2 } in one block covers both this and #55.

Ray · 1h ago

Follow-up from John: on top of play-once, add a play/pause button in the 3D viewer so a user can replay the animation after it settles. i.e. it plays once on load and holds assembled (this issue), and a small ▶/⏸ control lets them trigger it again. Thanks!

Log in to reply.