Back to demos
Demo - Synced tracks
Two algorithms, one player
Bubble sort and insertion sort run on [5, 2, 8, 1, 9, 3]. Each produces its own trace; useSyncedTracks puts both under one cursor. By default the shorter trace holds its last frame. Align by pass and each outer pass ends on the same frame; whichever algorithm gets there first waits.
21 aligned frames · press A to switch
bubblestep 1/21
2
5
8
1
9
3
writeswap 0↔1
if (a[0] > a[1]) swap(0, 1)
// 5 > 2 → swap
insertionstep 1/16
2
5
8
1
9
3
writeshift 0↔1
while (j > 0 && a[j-1] > a[j]) swap(j-1, j) // j = 1
// shift left
1/21