@dioramajs/text/counter
Exports of @dioramajs/text/counter.
On this page
import { blurOf, default, flips } from '@dioramajs/text/counter'Functions
blurOf | Blur of a drum that turns `speed` digits a frame: a fast one shows a sharp digit, not a streak. |
flips | A flip card from digit `from` (-1 blank) to `to`, landing `time` seconds after it starts: the digits on its two faces and the angle of the falling flap at `t`, 0 at rest. |
fold | How far a drum or card stands out of the page at `t`, 0 flat: it rises at the trigger and unrolls after it lands at `land`, flat before the text takes over, so the hand-off shows nothing. |
format | `value` written the way `w` is: its separators, grouping, decimals and leading zeros. |
odometer | The odometer's value in units at `t` of `time` seconds: quartOut, then the last SETTLE units on a backOut whose slope matches it, so the drums slow down, overshoot and settle. |
parse | The first number in `text`, read as written: `12,480`, `99.9`, `4,2` or `1.204.500` in German, `1 204 500`, `12,34,567`. A lone point or comma before exactly three digits groups them unless it is the decimal separator of `lang`. Undefined without digits or past 15 of them. |
reel | A slot reel from digit `from` to `to` landing `land` seconds after it starts: its position in digits at `t`, whole turns included. It spins up, runs, slows down and overshoots as it lands. |
span | Seconds from the trigger until the number has landed and folded back into the text. |
wheels | Odometer drums for `units` (the value in its smallest decimal): drum 0 turns with the value, each drum above turns only while the one below goes from 9 to 0. One more drum than `n`. |
Constants
default | A number counts up to its value when it comes into view, on real 3D mechanics: digits on odometer drums, on deep slot reels behind a window, or on flip cards. The drums and cards fold back into the text when they land: the DOM text never changes, and at rest it is the element. |
Interfaces
Written | A number as the text writes it: where it sits, its value, separators and grouping. |