Motion
Animate transform and opacity. Inline links transition color and underline, and they do not move.
Tokens
The spring curve is 450ms and peaks at 4%. Lift uses ease-out. Press is 34ms.
- --snicol-ease-spring
- linear(0, 0.42 16%, 0.86 38%, 1.04 58%, 0.997 80%, 1)
- --snicol-duration-spring
- 450ms
- --snicol-motion-duration-fast
- 120ms
Helpers
Lift and press are CSS classes. Boop is the useBoop hook.
Lift
Hover the button. It moves up 1px, then eases back.
Press
Press the button. It scales to 0.96, then releases over 250ms.
Boop
Hover or focus the button. It translates by 2px and -4px, rotates -8deg, and scales to 1.05. It holds for 150ms, then springs back.
At rest
Reduced motion
When the browser reports prefers-reduced-motion: reduce, transform rules do not apply. Color changes still use the color enter and exit durations. The sun and moon swap with no transition and no animation. The useBoop hook also refuses to start a boop while that query matches. Inline links do not transform.