Skip to content

feat(videos): real LDVP gifs + narration-synced highlight + auto-fit stat#451

Merged
jjackson merged 1 commit into
mainfrom
feat/template-cycle-gifs-and-stat-fit
May 18, 2026
Merged

feat(videos): real LDVP gifs + narration-synced highlight + auto-fit stat#451
jjackson merged 1 commit into
mainfrom
feat/template-cycle-gifs-and-stat-fit

Conversation

@jjackson
Copy link
Copy Markdown
Owner

Summary

Three template-level fixes that land for every program (chc, mbw, kangaroo-mother-care, …) — not just one spec:

# Fix
1 Real Learn/Deliver/Verify/Pay gifs from connect.dimagi.com's prelogin surface, used in place of the placeholder numbered circles. Animated via @remotion/gif so each frame composites into the rendered mp4.
2 Cycle highlight syncs to narration keyword positions. Old behavior: split cycle beat into four equal quarters regardless of when the voiceover actually said each word. New: parse spec.narration.by_beat.cycle, find word index of "learn"/"deliver"/"verif"/"paid" (stem-matched), use those normalized positions. Falls back to even quarters when any keyword is missing or out of order. For chc, positions land at 27/41/68/100% — meaningfully different from 25/50/75/100.
3 StatCard auto-fits the headline number. The old fixed 280px overflowed "1,000,000+" past the 1920px canvas — "1," and "+" clipped off the edges. Now 2200 / chars clamped to [120, 280] with whiteSpace: nowrap. Empirically tuned to 0.75em-per-glyph at fontWeight 800.

Verification

Eyeball-checked frames extracted from a fresh chc/run-001 render:

  • t=4.5s — Learn highlighted (CommCare app screen)
  • t=6.5s — Deliver highlighted (registered caregivers screen)
  • t=9s — Verify highlighted (table view)
  • t=11s — Pay highlighted (payment receipt)
  • t=25s — "1,000,000+" fits with breathing room, no clipping

🤖 Generated with Claude Code

…stat

Three template-level fixes that apply to every program, not just chc:

1. Cycle steps use the real Learn/Deliver/Verify/Pay animated gifs.

   Pulled the four marketing gifs from connect.dimagi.com's prelogin
   surface (the same ones on the homepage) into
   public/cycle/{learn,deliver,verify,pay}.gif and replaced the
   placeholder numbered circles in CycleStep with <Gif> from
   @remotion/gif (4.0.460, matching the renderer's Remotion version).
   The accent-color ring around the gif still grows and intensifies
   when a step is highlighted.

2. Cycle highlight walks at the narration's keyword positions.

   The old behaviour split the cycle beat into four equal quarters
   regardless of when the voiceover actually said each word. The new
   Cycle component parses spec.narration.by_beat.cycle, finds the
   word index of "learn"/"deliver"/"verif"/"paid" (stem-matched, so
   "verified" hits, "payment" doesn't), and uses those normalized
   positions as the highlight transitions. Falls back to even
   quarters if any keyword is missing or out of order.

   For the chc spec ("Connect runs a cycle: workers LEARN the
   protocol, DELIVER care in homes, evidence is VERIFIED through the
   app, then they are PAID."), word positions land at 27%, 41%, 68%,
   100% — meaningfully different from 25/50/75/100.

3. StatCard auto-fits the headline number to the frame.

   The old fixed 280px overflowed for "1,000,000+" (11 chars) — the
   "1," at the left and "+" at the right got clipped off the canvas.
   Now the size is computed from the string length using an
   empirically-measured 0.75em-per-glyph constant: 2200 / chars,
   clamped to [120, 280]. Short values like "80%" stay punchy at the
   280 cap; "1,000,000+" lands at 200px with breathing room. Also
   added whiteSpace: nowrap so the commas aren't treated as
   line-break opportunities and a max-width on the wrapper.

All three changes were eyeball-verified by extracting frames from a
chc/run-001 render at t=4.5s (Learn), 6.5s (Deliver), 9s (Verify),
11s (Pay) and 25s (headline stat).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jjackson jjackson merged commit 8e5b2bf into main May 18, 2026
3 checks passed
@jjackson jjackson deleted the feat/template-cycle-gifs-and-stat-fit branch May 18, 2026 21:00
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