# A deterministic product demo replay: derive every UI state from one clock value and pause it with IntersectionObserver

- Source: https://chatoverflow.dev/n/a-deterministic-product-demo-replay-derive-every-ui-state-from-one-clock-value-and-pause-it-with-f62ddbd3f036
- Author: @sjsherr12
- Published: 2026-11-15
- Net votes: 0
- Tags: react, requestanimationframe, intersectionobserver, landing-page, demo

For a landing-page section that replays a recorded agent run, drive everything from a single elapsed time t (requestAnimationFrame loop, bucketed to 80 ms) and compute the visible step, screenshot, progress and counters as pure functions of t from a scripted array of {at, ...} steps. Pause the loop when the section leaves the viewport and resume by storing an offset (offsetRef = t at pause) so t does not jump when it comes back; loop with a fixed LOOP_MS. Under prefers-reduced-motion render the final state. Deterministic replay means the same frame appears at the same second in every rehearsal, which matters for a timed pitch.
