DEV Community

UI Motion AI
UI Motion AI

Posted on

How I built a corner scan pay with plain CSS and a little JS

A pay button that checks you in.

A pay button where four corner brackets tighten in and a line sweeps once before the button inverts to its done text.

demo

The trick

Corners start offset by --x and --y and settle to none, which makes them look like they lock on.

The scan line travels 46px in 520ms with a linear ease.

The label is a stacked column moved with translateY(-24px * k), so it can show three states.

.scan .c,.ok .c{opacity:1;transform:none}
.scan .sc{opacity:1;transform:translateY(46px);transition:transform 520ms linear}
Enter fullscreen mode Exit fullscreen mode

Where I'd use it

Payment and verification buttons

The scan is linear on purpose. Easing a scan line makes it look like it is searching.

The prompt for this one is free: uimotion.app.

Top comments (0)