Skip to main content

Loading and reveal

Loading​

While a balance is being fetched, show the number's shape instead of a grey block. With loading the glyphs keep their colour and a slanted glint of shimmerColor sweeps through them every shimmerDuration (950 ms). The layout is exactly what the real number will occupy, so nothing jumps when the value arrives: flip loading off and set value in the same render, and the glint fades out while the digits roll to the amount.

The glint is yours to shape: shimmerAngle leans it, shimmerWidth narrows or widens it, shimmerDirection turns it round, and shimmerDelay pauses between sweeps. shimmerBaseColor recolours the glyphs outside the band, which makes the classic skeleton: a pale figure with a darker sweep.

// A skeleton
<NitroNumber value={0} loading shimmerBaseColor="#E5E7EB" shimmerColor="#9CA3AF" shimmerWidth={1.4} />

// A quick, upright glint every second and a half
<NitroNumber value={balance} loading shimmerWidth={0.35} shimmerAngle={0} shimmerDuration={600} shimmerDelay={900} />

Under Reduce Motion the glint freezes, and the element is announced as loading.

Jackpot reveal​

NitroNumber's transitions are for values that change; a reveal is for the one value the user has been waiting for: the credit they were granted, the cashback, the jackpot. Casinos have tuned that moment for decades, and two presentations came out of it:

  • The win-meter rollup (revealStyle="count", the default). The figure opens at $0, smaller, and tallies up to the total the way a slot's win counter does: it takes off at once, runs at a constant rate, grows as it climbs and crawls into the total. Leading digits appear as the count reaches their place, so nothing reflows.
  • The reels (revealStyle="spin"). Every digit spins like a slot reel, then the reels lock one at a time from the left.

Both land with a pop, and all of it runs in the native engine; the JS thread is not involved once the reveal is fired.

Click the number while it plays to skip to the total, the way a player taps to slam the count.

The count with tiers on a Galaxy A22, a budget Android phone, next to a progressive jackpot and live wins that never stop ticking.

reveal has three states. Leave it undefined for a normal NitroNumber. false shows the opening frame of value, its final layout with every digit blank except the mandatory ones ($0.00), so the box is already the right size. true plays the reveal; flip it back to false to re-arm. Mounted with true, it plays on mount.

Tiers. revealMilestones are the thresholds a casino rollup escalates through ("big win → mega win"), in the figure's units; those at or above value are ignored, so you can pass one fixed table. Every tier gets an equal share of revealDuration and is one run of its own: the count ramps up out of a milestone and brakes into the next. On each milestone the figure punches, pauses for revealMilestoneHold and onRevealMilestone(index, value) fires: the moment for your banner, haptic and sound. Budget about a second per tier; the 2.2 s default suits a count without them.

PropDefault
revealDuration2200ms of the count, or until the last reel locks.
revealBounce0.12Overshoot of the landing pop and the milestone punches; 0 turns them off.
revealGrow0.2count: how much smaller the figure opens.
revealStagger200spin: ms between one reel locking and the next.
revealMilestonesnonecount: the tiers.
revealMilestoneHold0count: ms the count pauses on each tier.

onRevealEnd fires once the landing pop has rung out: sequence whatever follows the figure from there. ref.current.revealTo(value) plays a reveal whatever the prop says, and jumpTo(value) skips a running one. Under Reduce Motion a reveal snaps to value and onRevealEnd still fires.