Skip to content

fix(core): use totalDuration for GSAP repeat/yoyo tween introspection#872

Closed
miguel-heygen wants to merge 2 commits into
mainfrom
worktree-feat-codex-tetris-baked-audio
Closed

fix(core): use totalDuration for GSAP repeat/yoyo tween introspection#872
miguel-heygen wants to merge 2 commits into
mainfrom
worktree-feat-codex-tetris-baked-audio

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

Summary

  • GSAP introspection in collectRuntimeTimelinePayload used tween.duration() to compute scene clip time ranges. For tweens with repeat/yoyo, duration() returns the base single-cycle duration — a 12s repeating animation (duration: 0.75, repeat: 15) was measured as 0.75s instead of 12s.
  • Scene clips in the timeline UI showed drastically shorter durations than their actual visible animation window. For the Codex Tetris composition, the AI dot blink (10s→22s) appeared as a 0.75s clip, glow breathing repeats were similarly truncated.
  • Fix: use totalDuration() (GSAP 3+) which accounts for repeat count and yoyo, falling back to duration() for older or non-standard timeline implementations.

Test plan

  • Open Codex Tetris composition in studio — scene clips in the timeline should now span their full animated duration
  • Verify repeat/yoyo tweens (AI dot blink, glow breathing, scan text blink) show correct ranges
  • Compositions without repeat tweens should be unaffected (same behavior as before)
  • bun run test passes (862 core + 514 studio tests)

WebAudio synth (oscillators, noise channels) can't be captured by the
headless renderer — it only picks up file-based <audio> tracks via
FFmpeg. This composition demonstrates the fix: a bake-audio.ts script
pre-renders chiptune BGM and SFX offline into WAV files using square/
triangle wave math, then the composition references them as standard
<audio> elements with data-start/data-duration/data-volume attributes.

Composition: 1080×1920 vertical, 28s, 4 scenes — QR scan → console
boot → Tetris gameplay (Penrose cursor AI, line clears, score counter)
→ game over + attribution. Glitch + chromatic aberration transitions.
… payload

The GSAP introspection in collectRuntimeTimelinePayload used
tween.duration() to compute scene clip ranges, which returns the base
duration of a single cycle. For tweens with repeat/yoyo, the actual
time range is tween.totalDuration() (base * (repeat+1)). This caused
scene clips to appear shorter than their visible duration in the
timeline UI — e.g. a 12s repeating animation showed as 0.75s.

Use totalDuration() when available (GSAP 3+), falling back to
duration() for timelines that don't expose it.
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