Flip-Dot Counter
Stats for your site on a flip-dot board, the kind on old buses: each pixel a disc that turns over, the change rippling across a column at a time as the number counts up into view. The cursor is a magnet that flips the dots under it; a click counts again.
Needs: None. A small canvas. The clatter uses Web Audio and only plays after a click.
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| value | number | required | The number to land on. |
| from | number | 0 | Where the count starts when it first comes into view. |
| decimals | number | 0 | Digits after the point. |
| prefix | string | "" | Set before the number, e.g. "$". |
| suffix | string | "" | Set after it, e.g. "+", "k" or "%". |
| group | boolean | true | Thousands commas. |
| duration | number | 1.8 | Seconds the count takes. |
| tone | string | "#f2c230" | The colour of a dot's bright side. The text colour when unset. |
| pitch | number | 7 | Size of one dot in px, disc plus gap. |
| sound | boolean | false | A soft clatter as the dots turn. Plays only after a click. |
| interactive | boolean | true | The cursor flips the dots under it like a magnet; a click counts again. |
| className | string | – | Class on the board. |
| style | CSSProperties | – | Style on the board. Theme it through the --mlui-* variables. |