feat(scene): add --lottie overlay support to vibe scene add#212
Conversation
Wire --lottie <path>, --lottie-position, --lottie-scale, --lottie-opacity, and --lottie-no-loop flags into the scene add command. When supplied, the Lottie file is copied into assets/ and a <dotlottie-wc> web component is layered on top of the selected preset's content. Position/scale/opacity vocabulary mirrors vibe edit motion-overlay so users and agents get consistent behavior across both paths. Closes vericontext#208 (scene helper milestone).
|
@Metbcy is attempting to deploy a commit to the Kiyeon Jeon's projects Team on Vercel. A member of the Team first needs to authorize it. |
kiyeonjeon21
left a comment
There was a problem hiding this comment.
Thanks for picking this up — the CLI surface and the scene-html-emit wiring look reasonable, but there's a blocker in how the runtime is loaded.
Blocker — the overlay won't render
The injected script points at @nicepkg/dotlottie-wc:
https://cdn.jsdelivr.net/npm/@nicepkg/dotlottie-wc@0.5.0/dist/index.js
That package doesn't exist on npm (404), so the URL is dead and <dotlottie-wc> never gets registered — the overlay just silently doesn't render. The component we already use is @lottiefiles/dotlottie-wc, which is a dependency in packages/cli/package.json.
Have a look at how the pipeline renderer handles this in pipeline/renderers/html-template.ts and project-builder.ts: it vendors the @lottiefiles/dotlottie-wc runtime and calls setWasmUrl(...), since dotLottie needs its WASM player to render. The scene path does load GSAP from jsdelivr, so a CDN load isn't off the table here — but it has to be the real package and the WASM has to resolve.
It'd also be good to add a test that exercises the emit path. scene-html-emit.test.ts has nothing for the lottie branch, which is why CI stayed green despite the dead URL.
Smaller things
--lottie-scale(0.01–2) and--lottie-opacity(0–1) advertise ranges in the help text but aren't validated — only--lottie-positionis.lottieOverlayParamsinhtml-clips.tsclamps both withMath.max/min; worth mirroring.- Non-full positions default scale to 1, so
--lottie-position bottom-rightwith no--lottie-scalepaints a 100%-size overlay in the corner. The existing helper defaults non-full positions to 0.25. - The
--dry-runparams object inscene.tsonly forwardslottieandlottiePosition—lottieScale/lottieOpacity/lottieNoLoopare dropped from the preview. - Minor:
scene.tsre-lists the position values as a literal array — you already exportLOTTIE_POSITIONS, so reuse it. Andid="lottie-overlay"is hardcoded, so two scenes with overlays would collide on the id.
Thanks for the context, I'll see if I can have the bigger blockers resolved soon. |
Address PR review blocker: the injected overlay script pointed at
@nicepkg/dotlottie-wc which doesn't exist on npm (404), so
<dotlottie-wc> never registered and the overlay silently never
rendered.
- swap CDN to @lottiefiles/dotlottie-wc@0.9.12 (matches package.json)
- import setWasmUrl and point it at @lottiefiles/dotlottie-web's
dotlottie-player.wasm, mirroring pipeline/renderers/html-template.ts
(the runtime can't render without the WASM player URL)
- mirror html-clips.ts clamps: scale [0.01, 2], opacity [0, 1]
- default non-full positions to scale 0.25 so corner overlays
don't paint full-screen
- scope overlay id per-scene (lottie-overlay-${sceneId}) so two
scenes with overlays don't collide on the DOM id
- validate --lottie-scale and --lottie-opacity ranges (help text
already advertised them; only --lottie-position was validated)
- reuse LOTTIE_POSITIONS in scene.ts instead of re-listing literals
- forward lottieScale / lottieOpacity / lottieLoop in --dry-run so
preview matches the actual run
- add 9 regression tests covering the lottie branch of
scene-html-emit (real package, setWasmUrl, per-scene id, clamps,
defaults, escape)
|
Thanks for the careful review. Pushed ad5b4a3 to address everything: Blocker — swapped to Smaller things
Tests — added a |
There was a problem hiding this comment.
Verified the follow-up commit. The Lottie runtime now points at the real @LottieFiles package, sets the WASM URL explicitly, validates the new flags, preserves the corner default scale, includes dry-run params, and adds regression coverage for the emit path. I also checked the package versions and tested this on top of current main with focused scene tests plus build.
The remaining Vercel failure is an authorization issue, not a code issue.
What
Adds Lottie animation overlay support to
vibe scene add, closing the "scene helper" milestone of #208.New CLI flags
--lottie <path>.jsonor.lottieanimation file--lottie-position <pos>--lottie-scale <n>--lottie-opacity <n>--lottie-no-loopHow it works
assets/lottie-<scene-id>.<ext><dotlottie-wc>web component (loaded from CDN) is layered on top of whatever preset is selectedvibe edit motion-overlayso behavior is consistent across both pathsExample
vibe scene add "intro" \ --lottie assets/logo-spin.json \ --lottie-position center \ --lottie-scale 0.5 \ --lottie-opacity 0.8Files changed
packages/cli/src/commands/_shared/scene-html-emit.ts: New types (LottiePosition,LottieOverlayInput), overlay style builder,<dotlottie-wc>markup emitter, wired intoemitSceneHtml()packages/cli/src/commands/scene.ts: CLI flags, validation, asset copy, result surfaceRefs #208