loading code fetching the highlighted snippet
Four coloured tiles shuffle their order every second. Each tile carries layout — motion measures the rect before + after the array mutation, then springs each tile between positions.
backgroundColor — Svelte tracks the same item across re-renders
even when its index changes, so motion sees a position change instead of an unmount +
remount and can FLIP it.motion.li has layout on it. Motion samples each item's
rect before and after the array mutation; the difference becomes the FLIP delta, and the
configured spring carries the tile to its new spot.setTimeout in onMount, recursing via scheduleNextShuffle() so a single source schedules every cycle. onMount's cleanup clears the
pending timeout — important when the component unmounts mid-flight.