REFERENCE
- Gallery page: https://magpui.com/en/i/draw-a-signature-onto-a-receipt-539979
- First frame (image): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/draw-a-signature-onto-a-receipt-539979/shot.jpg
- Clip (mp4): https://dnioievkvxejjbxgwvko.supabase.co/storage/v1/object/public/media/draw-a-signature-onto-a-receipt-539979/clip.mp4
- Original post: https://60fps.design/shots/run-receipt-signature-interaction by Run Receipt
Before building, download the first frame and look at it. If ffmpeg is available, download the clip and extract frames (ffmpeg -i clip.mp4 -vf fps=2 frame-%02d.png), then study the motion frame by frame. Match what you see; the text below describes it, the frames are the truth.
BUILD: Build a compact receipt signing interaction, not an entire app. Open a spacious white signature surface from a receipt action, capture a real handwritten mark, and place that same mark near the bottom of a paper receipt after confirmation. Keep the result quiet and monochrome.
DESIGN SYSTEM: At a reference width of 390px, use a 330px white receipt over a #EEEEEC background, with 20px internal padding, faint #D8D8D5 separators and a small sawtooth bottom edge. Use 11px monospaced labels, 14px totals and charcoal #171717 text. The drawing surface is mostly empty, with a thin black 2px round-capped line, a small uppercase signature label, Clear, and a black rounded Confirm button. A compact bottom action row contains Save, appearance and signature actions.
MOTION: Pointer movement draws the stroke immediately without easing. On Confirm, dismiss the signing surface over an estimated 280ms using cubic-bezier(0.22,1,0.36,1). Once the paper is visible, reveal the actual captured signature over 450ms with an SVG stroke mask and cubic-bezier(0.25,0.1,0.25,1), with no particles or dramatic bounce. These timings are reconstruction targets rather than measured source values.
SECTIONS: Unsigned receipt with short metric rows, dividers, fine-print block and timestamp; signing surface with empty, drawing, Clear and Confirm states; signed receipt retaining exactly the drawn mark; bottom action controls. Use placeholder data and an original signature drawn by the user, not a stock scribble.
IMPLEMENTATION: Use Pointer Events and an SVG path normalized to its viewBox for input; use Motion for panel exit and paper reveal. Preserve all path points when scaling the signature into the receipt. Track pointer input in refs and update at most once per animation frame. Trap focus in the modal, support Escape and restore focus to the trigger. Provide a typed-name alternative so handwriting is not required. Disable Confirm until input exists. With prefers-reduced-motion, instantly switch views and display the complete signature.
ADAPT TO THE PROJECT: Reuse existing project design tokens, components and fonts; map these colors to the closest existing tokens. Never copy logos, brand names, photos or illustrations from the original; use placeholder receipt data.
SUCCESS CHECK:
- Drawing, clearing and confirming work with touch and mouse; keyboard users can provide a typed name.
- The same signature appears on the receipt without clipping or distortion.
- Focus returns correctly and reduced-motion users get an immediate stable result.