Menu

Mask Reveal Code: the small motion details that make it feel right
📰

Mask Reveal Code: the small motion details that make it feel right

DEV Community: css·UI Motion AI·11 days ago
#hdtviAOg
#devtocss#devto#dev#translatex#transform
Long article (256 words) — no AI summary yet.
Reading 0:00
15s threshold

Four digits, and the cells become one solid panel.

A code field where four digits trigger a panel that opens across the cells from left to right with a confirmation word. A wrong code shakes the row and clears it.

The trick

The panel is a veil clipped with inset(0 100% 0 0), and opening it is just animating that clip to 0.

Motion goes through one small go() helper on the Web Animations API, which sets durations to 1ms for reduced motion.

The shake is six translateX keyframes of 8 then 4 pixels, which decays like a real shake.

.veil { position : absolute ; inset : 0 ; background : var ( --fx-on ) ; color : var ( --fx-on-ink ) ; display : flex ; align-items : center ; justify-content : center ; gap : 8px ; font-weight : 600 ; font-size : 16px ; clip-path : inset ( 0 100 % 0 0 ) ; pointer-events : none ; z-index : 2 } const shake = el => go ( el , [ { transform : 'translateX(0)' } , { transform : 'translateX(-8px)' } , { transform : 'translateX(8px)' } , { transform : 'translateX(-4px)' } , { transform :…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.