stepwise
Back to demos

Demo - Live simulation

Change the input while it plays

This trace isn't recorded by hand. useSimulation runs an insertion-sort generator on the numbers below and plays the result. Nudge a value with the arrows (or press R for a seeded random input): the trace is recomputed and the playhead stays on the same comparison, because every step carries a key like c3.2. The URL holds the exact input, so a copied link replays this run frame for frame.

startstart
key start · 34 steps
5
2
8
1
9
3
7
for (let i = 1; i < n; i++)
1/34
apps/demo/app/simulate/demo.tsx - 301 lines GitHub Open in StackBlitz