tactile-odometer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,93 @@
1
+ Copyright 2019 The Big Shoulders Project Authors (https://github.com/xotypeco/big_shoulders)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
package/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ciprian Titire
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ The numerals, big-shoulders-bold.woff2, are Big Shoulders Bold, copyright 2019
24
+ The Big Shoulders Project Authors (https://github.com/xotypeco/big_shoulders),
25
+ licensed under the SIL Open Font License 1.1; see BigShoulders-OFL.txt.
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # tactile-odometer
2
+
3
+ A mechanical drum counter for the web that carries like the real thing.
4
+
5
+ On a real odometer a drum only moves while the one to its right is carrying,
6
+ so 1,099 → 1,100 rolls the last three drums over together, right at the end of
7
+ the units' turn. Most animated counters move every digit on its own, so
8
+ nothing carries. This one does.
9
+
10
+ Vanilla ES module and CSS, no dependencies, no build step. MIT.
11
+
12
+ **[Play with it →](https://tactile-ui.me/objects/odometer)**
13
+
14
+ <!-- demo gif: 1,099 → 1,100, then +37 -->
15
+
16
+ ## Install
17
+
18
+ ```sh
19
+ npm install tactile-odometer
20
+ ```
21
+
22
+ Or straight from a CDN:
23
+
24
+ ```html
25
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tactile-odometer/odometer.css">
26
+ <script type="module">
27
+ import Odometer from 'https://cdn.jsdelivr.net/npm/tactile-odometer/odometer.mjs';
28
+ </script>
29
+ ```
30
+
31
+ ## Use
32
+
33
+ ```html
34
+ <div id="seats" style="width: 480px; height: 160px"></div>
35
+
36
+ <script type="module">
37
+ // with a bundler; without one, use the CDN URLs above
38
+ import Odometer from 'tactile-odometer';
39
+ import 'tactile-odometer/odometer.css';
40
+
41
+ const seats = new Odometer(document.getElementById('seats'), { value: 1099 });
42
+
43
+ seats.setValue(1100); // rolls, and carries
44
+ seats.setValue(4821.75); // springs there; fast drums spin, slow ones roll
45
+ seats.count(1); // a live tally, +1 a second (0 stops it)
46
+ seats.update({ finish: 'brass' });
47
+ seats.destroy(); // removes everything it added
48
+ </script>
49
+ ```
50
+
51
+ It works in React, Vue, Svelte or anything else that can hand it an element:
52
+ create it in an effect or `onMount`, call `destroy()` on unmount.
53
+
54
+ ### Options
55
+
56
+ | Option | Default | What it does |
57
+ |---|---|---|
58
+ | `value` | `0` | The number to start on |
59
+ | `decimals` | `0` | Drums after the decimal point (0 to 6) |
60
+ | `prefix`, `suffix` | `''` | Printed on the plate either side of the window: `$`, `km`, `seats left` |
61
+ | `locale` | `'en-US'` | Group and decimal marks, grouping pattern and digit glyphs, from `Intl.NumberFormat` |
62
+ | `grouping` | `true` | Fixed plates between drums: 1,099 rather than 1099 |
63
+ | `digits` | `1` | Whole-number drums to reserve, so a growing number doesn't move the layout |
64
+ | `zeros` | `false` | Print 001,099 like a car odometer, instead of blanks |
65
+ | `finish` | `'ink'` | `ink`, `bone`, `steel` or `brass`, each in its own housing |
66
+ | `red` | `'none'` | Signal-red drums: `last`, or all the `decimals` (the classic tenths) |
67
+ | `bezel` | `'slot'` | One `slot` across the drums, `cells` like a tally counter, or `bare` to sit in a line of text |
68
+ | `stiffness` | `140` | How hard the value is pulled to a new number |
69
+ | `damping` | `0.85` | Below 1 it overshoots and winds back; 1 and above it arrives without passing |
70
+ | `maxSpin` | `24` | Digits per second; past this a drum is drawn spinning at the cap, blurred, instead of strobing |
71
+ | `count` | `0` | A live tally per second, in steps of the last drum; negative counts down |
72
+ | `wear` | `0.35` | Drums a little off their detents, figures a little off register |
73
+ | `light` | `315` | Where the lamp is, in degrees (0 is above, clockwise) |
74
+ | `size` | `'fit'` | `'fit'` fills the host and follows it; a number is the numeral size in px |
75
+ | `label` | `''` | Engraved into the plate under the window |
76
+ | `sound` | `false` | A soft tick per step of the last drum (a whirr when it spins), once the page has had a click or key press |
77
+ | `announce` | `true` | Announce the landed value to screen readers; `false` for an ambient tally |
78
+
79
+ ### Methods
80
+
81
+ - `setValue(n, { instant })`: spring to a new value, or jump with `instant: true`
82
+ - `count(rate)`: tally `rate` per second; `count(0)` stops
83
+ - `update(options)`: change any option
84
+ - `destroy()`: stop and remove everything
85
+ - `value`, `state`: the target value, and `running` or `asleep`
86
+
87
+ ## How the carry works
88
+
89
+ Only the last drum is driven. Every other drum moves only while the drum to
90
+ its right passes 9 → 0. The first carry takes the last tenth of the units'
91
+ step, and every carry above it turns in lock-step with the drum below, which is
92
+ why the carries all roll together at the end.
93
+
94
+ That rule is one pure function of a single continuous value:
95
+
96
+ ```js
97
+ export function drumPositions(value, count, decimals = 0, carry = CARRY) {
98
+ const n = scaled(value, decimals);
99
+ const out = new Array(count);
100
+ if (count < 1) return out;
101
+ let below = n % 10;
102
+ out[0] = below;
103
+ for (let k = 1; k < count; k += 1) {
104
+ const w = k === 1 ? carry : 1;
105
+ const digit = Math.floor(n / 10 ** k) % 10;
106
+ below = digit + clamp((below - 10 + w) / w, 0, 1);
107
+ out[k] = below;
108
+ }
109
+ return out;
110
+ }
111
+ ```
112
+
113
+ The value itself is a spring, so the whole counter animates one number and
114
+ every drum follows from this. `scaled()` removes float dust, so 10.1 at two
115
+ decimals is 1010, not 1009.9999999999999.
116
+
117
+ The rest:
118
+
119
+ - **The light doesn't turn.** A drum is a cylinder on a horizontal axle, so
120
+ the light on it depends only on height in the window, not on how far it has
121
+ turned. One overlay per drum, computed once from the lamp; the numerals roll
122
+ through it.
123
+ - **Real text.** The faces are DOM text on a ten-sided CSS 3D drum, so the
124
+ figures are crisp and properly foreshortened.
125
+ - **The numerals** are Big Shoulders Bold, bundled, so the drums print the same
126
+ figures everywhere. The font loads `block` and the figures are re-centred on
127
+ it once it lands, so nothing jumps.
128
+
129
+ ## Accessibility and cost
130
+
131
+ - The drums are `aria-hidden`. The number is a visually hidden text element,
132
+ announced politely once the value has landed: never every frame.
133
+ - Reduced motion: the value changes instantly, nothing spins, no frame is
134
+ requested.
135
+ - It costs nothing at rest. The loop runs only while a value is travelling,
136
+ sleeps once it lands, sleeps between the steps of a slow tally, and pauses
137
+ off screen and in a hidden tab. A tab that comes back after two seconds
138
+ can't blow up the spring.
139
+
140
+ ## Compared
141
+
142
+ | | tactile-odometer | odometer.js (HubSpot) | NumberFlow |
143
+ |---|---|---|---|
144
+ | 1,099 → 1,100 | tens and hundreds carry together at the end of the units' turn | every digit column slides at once, over the same duration | each digit animates on its own |
145
+ | Dependencies | none | none | one small one (`esm-env`), plus React, Vue and Svelte packages |
146
+ | Screen readers | real text, announced once when it lands | not built in | described as accessible |
147
+ | Reduced motion | instant change | not built in | respected by default |
148
+ | Big jumps | fast drums blur at a spin cap, slow ones roll | each column slides through its ribbon | digits transition |
149
+
150
+ The odometer.js column is from its source (`animateSlide` builds one ribbon
151
+ per digit column and slides them together). The NumberFlow column is from its
152
+ docs and npm, and from watching it; its docs don't describe the carry. If
153
+ anything here is wrong, open an issue and I'll fix the table.
154
+
155
+ ## Tests
156
+
157
+ ```sh
158
+ npm test
159
+ ```
160
+
161
+ The pure parts (the carry, the spring, formatting, fitting, the light) are
162
+ tested in Node with `node:test`.
163
+
164
+ ## Where it's from
165
+
166
+ It's the free piece of [Tactile UI](https://tactile-ui.me), a library of
167
+ interface objects that work like the hardware they're drawn from: a pin
168
+ screen, a Chladni plate, a detent dial, a cassette. The rest are paid; this
169
+ one is MIT, for everyone.
170
+
171
+ Made by [Ciprian Titire](https://titi.re).
172
+
173
+ ## Licence
174
+
175
+ MIT. The numerals, `big-shoulders-bold.woff2`, are under the SIL Open Font
176
+ License 1.1; see `BigShoulders-OFL.txt`.
Binary file
package/odometer.css ADDED
@@ -0,0 +1,398 @@
1
+ /* Odometer — TACTILE UI.
2
+ The object sizes itself from its numeral size (--od-size, set by the
3
+ component: filling its host in fit mode, or from the `size` option). Every
4
+ length below is in em of that size, so the drum geometry scales as one
5
+ piece. Lamp-dependent values (--od-shade, --od-spec, --od-wall, …) are
6
+ written by the component from the `light` option. */
7
+
8
+ /* The drums are printed in Big Shoulders Bold (SIL OFL 1.1, see
9
+ BigShoulders-OFL.txt beside this file): the same figures on every platform.
10
+ `block`: until the face is in, the drums show no figures rather than a
11
+ fallback that jumps when it arrives. */
12
+ @font-face {
13
+ font-family: 'Odometer Figures';
14
+ src: url('./big-shoulders-bold.woff2') format('woff2');
15
+ font-weight: 100 900;
16
+ font-style: normal;
17
+ font-display: block;
18
+ }
19
+
20
+ .od {
21
+ --od-size: 72px;
22
+ --od-face: 1.12em; /* one face: the chord between two numerals */
23
+ --od-r: 1.7235em; /* ten faces: radius = face / (2 tan 18°) */
24
+ --od-win: 1.56em; /* the window shows ±27° of the drum */
25
+ --od-w: 0.6em; /* drum width: a condensed figure on a narrow drum */
26
+ /* Printed stock is never a flat fill: a fine static grain, blended over the drum colour. */
27
+ --od-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0.5 0.3 0.2 0 0 0.5 0.3 0.2 0 0 0.5 0.3 0.2 0 0 0 0 0 0 0.42'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
28
+ /* Brushing: long fine streaks along the plate. */
29
+ --od-brushed: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='120'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0022 0.95' numOctaves='3' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0.6 0.2 0.2 0 0.08 0.6 0.2 0.2 0 0.08 0.6 0.2 0.2 0 0.08 0 0 0 0 0.6'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)'/%3E%3C/svg%3E");
30
+ position: relative;
31
+ display: inline-block;
32
+ width: max-content;
33
+ vertical-align: middle;
34
+ font-size: var(--od-size);
35
+ line-height: 1;
36
+ font-family: 'Odometer Figures', Bahnschrift, 'DIN Alternate', 'DIN Condensed', 'Barlow Semi Condensed', 'Roboto Condensed', 'Arial Narrow', sans-serif;
37
+ font-weight: 700;
38
+ font-stretch: 87.5%;
39
+ font-synthesis: none;
40
+ font-variant-numeric: lining-nums;
41
+ font-kerning: none;
42
+ -webkit-font-smoothing: antialiased;
43
+ }
44
+
45
+ /* The number, as text. Hidden from sight, read by everything else. */
46
+ .od-text {
47
+ position: absolute;
48
+ width: 1px;
49
+ height: 1px;
50
+ margin: -1px;
51
+ overflow: hidden;
52
+ clip-path: inset(50%);
53
+ white-space: nowrap;
54
+ }
55
+
56
+ /* The housing: a machined plate the window is cut into. Window in the
57
+ middle column, a printed prefix and suffix either side, an engraved label
58
+ under the window. */
59
+ .od-plate {
60
+ position: relative;
61
+ display: grid;
62
+ grid-template-columns: auto auto auto;
63
+ align-items: center;
64
+ padding: 0.2em 0.2em;
65
+ border: 0.028em solid;
66
+ border-color: var(--od-raise);
67
+ border-radius: 0.11em;
68
+ color: var(--od-plate-ink);
69
+ background:
70
+ var(--od-plate-sheen),
71
+ var(--od-brushed),
72
+ var(--od-metal);
73
+ background-origin: border-box;
74
+ background-size: 100% 100%, 100% 100%, 600px 120px, auto;
75
+ background-blend-mode: normal, normal, overlay, normal;
76
+ box-shadow: var(--od-plate-shadow), inset 0 0 0 0.006em rgb(0 0 0 / 0.35);
77
+ -webkit-user-select: none;
78
+ user-select: none;
79
+ }
80
+ /* Room at each end for a screw. */
81
+ .od[data-bezel='slot'] .od-plate,
82
+ .od[data-bezel='cells'] .od-plate { padding-inline: 0.42em; }
83
+ .od-window { grid-column: 2; grid-row: 1; }
84
+
85
+ /* The chamfers catch the lamp hardest at the corner nearest it (the plate's
86
+ edge) or farthest from it (the window's walls, which face back toward it):
87
+ a specular falloff laid over each side's own tone. The window's ring is
88
+ the plate's: an absolutely placed grid item takes the window's grid area as
89
+ its box, and the window itself clips its drums. */
90
+ .od-plate::before,
91
+ .od-plate::after {
92
+ content: '';
93
+ position: absolute;
94
+ z-index: 3;
95
+ -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
96
+ -webkit-mask-composite: xor;
97
+ mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
98
+ pointer-events: none;
99
+ }
100
+ .od-plate::before {
101
+ inset: -0.028em;
102
+ padding: 0.028em;
103
+ border-radius: inherit;
104
+ background: var(--od-raise-hot);
105
+ }
106
+ .od-plate::after {
107
+ grid-column: 2 / 3; /* an absolute item's auto end line would be the padding edge */
108
+ grid-row: 1 / 2;
109
+ inset: 0;
110
+ padding: 0.036em;
111
+ border-radius: 0.055em;
112
+ background: var(--od-recess-hot);
113
+ }
114
+ .od[data-bezel='bare'] .od-plate::before,
115
+ .od[data-bezel='bare'] .od-plate::after,
116
+ .od[data-bezel='cells'] .od-plate::after { display: none; }
117
+
118
+ /* A countersunk screw: the sink cut into the plate, the domed head in it,
119
+ the slot across the head. */
120
+ .od-screw {
121
+ position: absolute;
122
+ top: 50%;
123
+ width: 0.17em;
124
+ height: 0.17em;
125
+ margin-top: -0.085em;
126
+ border-radius: 50%;
127
+ background: color-mix(in srgb, var(--od-metal-dark) 70%, var(--od-metal));
128
+ box-shadow: var(--od-screw-sink);
129
+ }
130
+ .od-screw-l { left: calc(0.21em - 0.085em); }
131
+ .od-screw-r { right: calc(0.21em - 0.085em); }
132
+ .od-screw::before {
133
+ content: '';
134
+ position: absolute;
135
+ inset: 0.022em;
136
+ border-radius: 50%;
137
+ background:
138
+ radial-gradient(circle at var(--od-screw-hl), rgb(255 255 255 / 0.9) 0, rgb(255 255 255 / 0) 34%),
139
+ radial-gradient(circle at var(--od-screw-hl), var(--od-screw) 0, color-mix(in srgb, var(--od-screw) 55%, #000) 78%, color-mix(in srgb, var(--od-screw) 30%, #000) 100%);
140
+ box-shadow: var(--od-screw-shadow);
141
+ }
142
+ .od-screw::after {
143
+ content: '';
144
+ position: absolute;
145
+ left: 0.032em;
146
+ right: 0.032em;
147
+ top: 50%;
148
+ height: 0.024em;
149
+ margin-top: -0.012em;
150
+ border-radius: 0.01em;
151
+ background: rgb(0 0 0 / 0.78);
152
+ box-shadow: 0 0.005em 0 rgb(255 255 255 / 0.28);
153
+ transform: rotate(var(--od-slot, 30deg));
154
+ }
155
+
156
+ .od-prefix,
157
+ .od-suffix {
158
+ color: var(--od-plate-ink);
159
+ text-shadow: var(--od-engrave);
160
+ white-space: nowrap;
161
+ }
162
+ .od-prefix {
163
+ grid-column: 1;
164
+ grid-row: 1;
165
+ position: relative;
166
+ top: var(--od-lift, 0);
167
+ font-size: 0.6em;
168
+ padding-inline: 0 0.2em;
169
+ }
170
+ .od-suffix {
171
+ grid-column: 3;
172
+ grid-row: 1;
173
+ align-self: end;
174
+ font-size: 0.24em;
175
+ letter-spacing: 0.14em;
176
+ text-transform: uppercase;
177
+ padding-inline: 0.55em 0;
178
+ margin-bottom: 0.9em;
179
+ }
180
+ .od-suffix.od-mark {
181
+ /* A symbol after the number (€, %) is set like the prefix, not as a label. */
182
+ position: relative;
183
+ top: var(--od-lift, 0);
184
+ align-self: center;
185
+ font-size: 0.6em;
186
+ letter-spacing: 0;
187
+ text-transform: none;
188
+ padding-inline: 0.2em 0;
189
+ margin-bottom: 0;
190
+ }
191
+
192
+ /* The engraved label strip: letters cut into the plate and filled with
193
+ paint, ruled out to the window's edges. */
194
+ .od-label {
195
+ grid-column: 2;
196
+ grid-row: 2;
197
+ /* The window's width, never more: a label longer than the window must not
198
+ widen its column (that would open a gap inside the window). It overflows
199
+ both ways instead, centred. */
200
+ width: 0;
201
+ min-width: 100%;
202
+ display: flex;
203
+ align-items: center;
204
+ justify-content: center;
205
+ gap: 0.7em;
206
+ margin-top: 0.55em;
207
+ margin-bottom: -0.15em;
208
+ font-size: 0.2em;
209
+ font-weight: 700;
210
+ letter-spacing: 0.3em;
211
+ text-transform: uppercase;
212
+ white-space: nowrap;
213
+ color: var(--od-plate-ink);
214
+ text-shadow: var(--od-engrave);
215
+ }
216
+ .od-label-t { margin-right: -0.3em; } /* the tracking after the last letter is not space */
217
+ .od-label::before,
218
+ .od-label::after {
219
+ content: '';
220
+ flex: 1 1 0;
221
+ min-width: 1em;
222
+ height: 0.12em;
223
+ border-radius: 0.1em;
224
+ background: color-mix(in srgb, var(--od-plate-ink) 55%, transparent);
225
+ box-shadow: var(--od-groove);
226
+ }
227
+
228
+ /* The window: a slot in the plate, with the drums behind it. */
229
+ .od-window {
230
+ position: relative;
231
+ display: flex;
232
+ height: var(--od-win);
233
+ padding: 0 0.045em;
234
+ gap: 0.04em;
235
+ background: #050506;
236
+ border: 0.036em solid;
237
+ border-color: var(--od-recess);
238
+ border-radius: 0.055em;
239
+ overflow: hidden;
240
+ box-shadow: var(--od-chamfer);
241
+ }
242
+
243
+ /* Glass over it: the lamp's reflection, the refracting edge, the window's walls. */
244
+ .od-glass,
245
+ .od-lens {
246
+ position: absolute;
247
+ inset: 0;
248
+ z-index: 2;
249
+ pointer-events: none;
250
+ border-radius: inherit;
251
+ background: var(--od-glass);
252
+ box-shadow: var(--od-wall);
253
+ }
254
+ .od-lens { display: none; }
255
+
256
+ /* One drum: ten printed figures around an axle, seen through the window. The
257
+ drum's surface is the cell (a cylinder's colour does not turn); the faces
258
+ carry only ink, so a smeared figure can run into the next without a seam. */
259
+ .od-cell {
260
+ position: relative;
261
+ flex: none;
262
+ width: var(--od-w);
263
+ background: var(--od-rim), var(--od-grain), var(--od-drum);
264
+ background-size: auto, 140px 140px, auto;
265
+ background-blend-mode: normal, overlay, normal;
266
+ }
267
+ /* Flat, with perspective: each face carries its own whole transform. */
268
+ .od-rot {
269
+ position: absolute;
270
+ left: 0;
271
+ right: 0;
272
+ top: 50%;
273
+ height: var(--od-face);
274
+ margin-top: calc(var(--od-face) / -2);
275
+ perspective: 16em;
276
+ }
277
+ .od-face {
278
+ position: absolute;
279
+ inset: 0;
280
+ display: grid;
281
+ place-items: center;
282
+ backface-visibility: hidden;
283
+ color: var(--od-figure);
284
+ }
285
+ .od-ink {
286
+ position: relative;
287
+ font-size: 0.92em;
288
+ top: var(--od-lift, 0);
289
+ display: grid;
290
+ place-items: center;
291
+ opacity: var(--ink, 1);
292
+ transition: opacity 0.18s;
293
+ }
294
+ .od-blank .od-ink { opacity: 0; }
295
+ .od-n,
296
+ .od-m { grid-area: 1 / 1; }
297
+ .od-n { opacity: calc(1 - var(--b, 0)); }
298
+ /* The same figure smeared along the turn: shown as the drum speeds up. Long
299
+ enough that, at full speed, one figure's streak meets the next one's. */
300
+ .od-m {
301
+ --s1: color-mix(in srgb, var(--od-figure) 6%, transparent);
302
+ --s2: color-mix(in srgb, var(--od-figure) 11%, transparent);
303
+ --s3: color-mix(in srgb, var(--od-figure) 16%, transparent);
304
+ --s4: color-mix(in srgb, var(--od-figure) 20%, transparent);
305
+ opacity: var(--b, 0);
306
+ color: transparent;
307
+ text-shadow:
308
+ 0 -0.48em 0.1em var(--s1), 0 -0.4em 0.09em var(--s2), 0 -0.32em 0.08em var(--s3),
309
+ 0 -0.24em 0.07em var(--s4), 0 -0.16em 0.06em var(--s4), 0 -0.08em 0.055em var(--s4),
310
+ 0 0 0.05em var(--s4),
311
+ 0 0.08em 0.055em var(--s4), 0 0.16em 0.06em var(--s4), 0 0.24em 0.07em var(--s4),
312
+ 0 0.32em 0.08em var(--s3), 0 0.4em 0.09em var(--s2), 0 0.48em 0.1em var(--s1);
313
+ }
314
+
315
+ /* Light that does not turn: the drum rolls under it. */
316
+ .od-cell::after,
317
+ .od-sep::after {
318
+ content: '';
319
+ position: absolute;
320
+ inset: 0;
321
+ pointer-events: none;
322
+ background: var(--od-spec), var(--od-shade);
323
+ }
324
+
325
+ /* The signal drum: the classic odometer tenths. */
326
+ .od-red {
327
+ --od-drum: var(--od-signal);
328
+ --od-figure: var(--od-signal-figure);
329
+ }
330
+
331
+ /* Fixed plates between drums: group marks, the decimal point, the sign. */
332
+ .od-sep {
333
+ position: relative;
334
+ flex: none;
335
+ display: grid;
336
+ place-items: center;
337
+ width: 0.22em;
338
+ background: var(--od-rim), var(--od-grain), var(--od-drum);
339
+ background-size: auto, 140px 140px, auto;
340
+ background-blend-mode: normal, overlay, normal;
341
+ color: var(--od-figure);
342
+ }
343
+ .od-sign { width: 0.4em; }
344
+ .od-glyph { font-size: 0.92em; position: relative; top: var(--od-lift, 0); transition: opacity 0.18s, transform 0.18s; }
345
+ .od-off .od-glyph { opacity: 0; }
346
+ .od-sign.od-off .od-glyph { transform: rotateX(90deg); }
347
+
348
+ /* A window per drum, like a tally counter. */
349
+ .od[data-bezel='cells'] .od-window {
350
+ background: none;
351
+ border: 0;
352
+ overflow: visible;
353
+ box-shadow: none;
354
+ padding: 0;
355
+ gap: 0.1em;
356
+ }
357
+ .od[data-bezel='cells'] .od-glass { display: none; }
358
+ .od[data-bezel='cells'] .od-cell {
359
+ overflow: hidden;
360
+ border: 0.03em solid;
361
+ border-color: var(--od-recess);
362
+ border-radius: 0.06em;
363
+ box-shadow: var(--od-chamfer);
364
+ }
365
+ .od[data-bezel='cells'] .od-lens { display: block; }
366
+ .od[data-bezel='cells'] .od-sep {
367
+ background: none;
368
+ width: 0.2em;
369
+ color: var(--od-plate-ink);
370
+ text-shadow: var(--od-engrave);
371
+ }
372
+ .od[data-bezel='cells'] .od-sep::after { display: none; }
373
+
374
+ /* No housing: the drums alone, to sit in a line of text. */
375
+ .od[data-bezel='bare'] .od-plate {
376
+ background: none;
377
+ border: 0;
378
+ box-shadow: none;
379
+ padding: 0;
380
+ color: inherit;
381
+ }
382
+ .od[data-bezel='bare'] .od-prefix,
383
+ .od[data-bezel='bare'] .od-suffix,
384
+ .od[data-bezel='bare'] .od-label {
385
+ color: inherit;
386
+ text-shadow: none;
387
+ }
388
+ .od[data-bezel='bare'] .od-label::before,
389
+ .od[data-bezel='bare'] .od-label::after { box-shadow: none; background: currentColor; opacity: 0.35; }
390
+ .od[data-bezel='bare'] .od-prefix { font-size: 0.8em; padding-inline-end: 0.1em; }
391
+ .od[data-bezel='bare'] .od-suffix:not(.od-mark) { font-size: 0.42em; margin-bottom: 0.3em; padding-inline-start: 0.3em; }
392
+ .od[data-bezel='bare'] .od-suffix.od-mark { font-size: 0.8em; }
393
+ .od[data-bezel='bare'] .od-window { border-width: 0.02em; border-radius: 0.08em; }
394
+
395
+ @media (prefers-reduced-motion: reduce) {
396
+ .od-ink,
397
+ .od-glyph { transition: none; }
398
+ }