Vibary.ai
← Vibe Coding

Price Change Roll

A recalculated total rolls digit by digit in the direction the money moved.

commercepremiumminimalautomatic · finite · intermediate · ~1.1s
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

359 lines · react + motion only
import { useEffect, useRef, useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Price Change Roll
 *
 * A recalculated total rolls into its new value one digit at a time:
 * changed digits travel in the direction the money moved, currency

About this pattern

When a total is recalculated the reader needs two things at once: the new figure, and which way it went. This rolls only the digits that actually changed, downward for a saving and upward for a rise, in a short cascade read left to right, while currency symbols and separators stay nailed in place. A delta chip lands a beat later with the size of the change and the reason for it. The type size never changes — a price that grows and shrinks mid-roll is unreadable exactly when someone is trying to read it.

Total recalculating at checkoutCurrency switch on a pricing pageEstimate updating as quantity changesLive tax and shipping recalculation

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • NewMenWomenSale
    Men's trail shoeRidgeline GT$132Bone
    88.599.510
    Add to bag
    Free delivery and returns
    Product details
    Product page

    Fare estimate settles on a new figure as options change, digits moving in place.

Related patterns