Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

Score

Displays a changing number using pooled digit icons.

import { Score } from 'filedom';

<Score value={points} places={4} at={{ x: 480, y: 80 }} />

Render Score inside a Stage. Each place mounts ten pooled sprites, one per digit face, and moves the one it needs into position, so no icon is ever swapped in place. Leading zeros are hidden and the visible digits are centered on at. Values are floored and clamped to zero, and digits beyond places are dropped from the high end.

Props

PropType
valuenumber

Number to show.

Typenumber
placesnumber

Number of digit positions.

Typenumber
atStagePoint | null

Readout center; null hides it.

TypeStagePoint | null
gap?number

Digit-center spacing in px. Default 0.62 × provider icon size. Required when the provider has no metrics; otherwise Score throws.

Typenumber
digitIcon?((digit: number) => IconDescriptor)

Face for digits 0 to 9. Defaults to scoreDigitIcon.

Type((digit: number) => IconDescriptor)

Was this page helpful?