Odometer: a rolling number counter with prefix, decimals and count-up timing.
import { Odometer, countDuration, digitCount, odometerColumns } from 'pixi-silk/ui/odometer';
Classes#
| Class | Description |
|---|
| Odometer | A number that rolls its digits into place like a mechanical counter, for live readouts, scores and totals. Each column shows two glyphs at most and the frame only moves them, so it stays cheap while counting. Glyphs come from a bitmap font made from the text style on first use. A mask clips the columns. The number is centred on the origin. |
Interfaces#
Functions#
| Function | Description |
|---|
| countDuration | Count-up time in seconds for a jump of delta units. With speedUp it scales base by 0.6 to 3, growing with the log of the jump. Without it, returns base. |
| digitCount | Number of digit columns the whole part of units needs, at least min. The sign is ignored. |
| odometerColumns | Roll position of every digit column for a value, lowest place first. units is the value in its smallest unit (value times 10 ** decimals). Each position runs from 0 to 10. A column only rolls while the column below it passes from 9 to 0, so carries ripple like a mechanical counter. |