Portfolio
  • 01Home
  • 02Projects
  • 03About
  • 04Skills
  • 05Lab
  • 06Writing
  • 07Contact

© 2026 Hamza Syrage

LabView all
Arrow FieldCursorCursor SpotlightCursorGooey CursorCursorImage CompareMediaInteractive ChartDataMagnetic ButtonInteractionMarquee RevealTypographyMorphing ShapeAnimationsNested ViewsOverlaysOdometer CounterDataParticle ConstellationCanvasRipple ClickButtonsScroll RevealScrollShuffle GridLayoutStep WizardNavigationTabsNavigationTilt CardCards

UI Experiments

All Lab Entries
Data

Odometer Counter

A slot-machine style counter where each digit spins independently.

A counter that just changes a number is boring. An odometer that spins each digit into place like a mechanical counter is satisfying. The trick is a clipped column of digits with a Y transform, driven by a spring that overshoots past the target before settling.

#Step 1: Digit column

A single column of digits 0-9 stacked vertically. Clicking a digit highlights it. This establishes the visual structure before adding animation.

Click a digit to select it

tsx
Loading...

#Step 2: Y transform

Replace the click-to-select with a motion.div that animates y to scroll the correct digit into view. flex-col-reverse puts 0 at the bottom, so the Y offset calculation is -(9 - value) * 10.

0
1
2
3
4
5
6
7
8
9
tsx
Loading...

#Step 3: Multi-digit

Map a number to individual digits, each in its own column. The key uses ${digits.length}-${i} so the layout reflows correctly when digits are added or removed (e.g., going from 99 to 100).

0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
tsx
Loading...

#Step 4: Spring physics

The spring transition (bounce: 0.12, duration: 0.8) overshoots past the target digit slightly, then settles. This creates the mechanical "click" feel of a real odometer. A tween would look like a smooth scroll rather than individual digits snapping into place.

0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
tsx
Loading...

#Configuration

Tune the spring physics for the digit scroll.

0
1
2
3
4
5
6
7
8
9
0
1
2
3
4
5
6
7
8
9
Parameters
Count99
Spring physics
Stiffness150
Damping15
Mass1
tsx
Loading...