Entrances

Motion · Next.js

Stock that fills in as it arrives

Each piece's stock meter fills in once the store's count arrives, and says when it has settled. Switch to after the delivery and they fill up from where they are.

With Wardic: Solid 1 · Solid 2

Live demo

Reduced motion: The bars are at their level at once, Wardic's reduced motion snapping their scale, and each label shows its count straight away.

Beside Wardic

Motion has no async values. Its version reads the count as React does: the page's server component starts the read, and the bars' client component waits for it with use(promise) under <Suspense>. A switch is a transition, with a promise kept for each when, as use needs the same one each render. Each bar's "filling…" is state set from onAnimationStart and onAnimationComplete, as on Solid 1; Solid 2 reads both from what it already has, the memo's pending count and the ward's settled(). And Motion starts each fill once React has hydrated the rows, where Wardic starts it as they stream in, from the CSS it writes into them.

The code

Highlighting…