DEV Community

UI Motion AI
UI Motion AI

Posted on

Ledger Pay Form: the small motion details that make it feel right

What you type rises into a readout above the form.

A payment form where card details climb into a ledger-style readout, with earlier digits masked and a code panel that wipes in.

demo

The trick

Each 4-digit group fades up 8px with the Web Animations API when it changes, and finished groups become bullets.

The security code panel swaps in with clip-path inset(0 100% 0 0) to inset(0), triggered by focus.

Pay draws a 3px line along the bottom with a scaleX animation before the done panel opens.

.face{position:absolute;inset:0;background:var(--fx-on);color:var(--fx-on-ink);display:flex;align-items:center;justify-content:space-between;padding:0 16px;clip-path:inset(0 100% 0 0);transition:clip-path .32s cubic-bezier(.65,0,.25,1);font-size:13px}
.read.cvc .f2,.read.done .f3{clip-path:inset(0)}
const rise=el=>go(el,[{opacity:0,transform:'translateY(8px)'},{opacity:1,transform:'none'}],{duration:160,fill:'none'});
cv.addEventListener('focus',()=>{if(!busy)read.classList.add('cvc')});cv.addEventListener('blur',()=>read.classList.remove('cvc'));
Enter fullscreen mode Exit fullscreen mode

Where I'd use it

Card payment forms

It's a demo, so the done message says no real charge. I'd rather be boring than get someone's real card number.

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

Top comments (0)