Money Send
A phone payment screen confirms Sent to Maya with a receipt.
Source
components/kuchi/money-send.tsx
1"use client";23import { loadFont } from "@remotion/google-fonts/HankenGrotesk";4import type React from "react";5import { useId } from "react";6import {7 AbsoluteFill,8 Easing,9 interpolate,10 interpolateColors,11 spring,12 useCurrentFrame,13 useVideoConfig,14} from "remotion";15import type { GradientParams } from "@/lib/kuchi/gsh/gradient-engine";16import { GshGround } from "@/lib/kuchi/gsh/gsh-ground";17import type { GshPresetId } from "@/lib/kuchi/gsh/presets";1819const hanken = loadFont("normal", {20 weights: ["300", "400"],21 subsets: ["latin"],22});2324export interface MoneySendProps {25 /** Full name; the first name is used in "Sent to …". */26 recipient?: string;27 /** Whole amount, typed digit by digit on the keypad. */28 amount?: number;29 /** ISO code, shown in the currency pill. USD, EUR, GBP and JPY get a symbol. */30 currency?: string;31 /** Letters are typed on the keyboard; a trailing emoji is picked from the suggestion bar. */32 note?: string;33 /** Three lines beside the phone: amount, note, sent. */34 lines?: [string, string, string];35 /** Placeholder of the note field. */36 notePlaceholder?: string;37 /** Button on the sent screen. */38 doneLabel?: string;39 /** Frames between keypad taps as the amount is typed. */40 stagger?: number;41 accent?: string;42 /** Color of the lines beside the phone; overrides the theme. */43 ink?: string;44 /** Solid fill in place of the gradient ground; "transparent" drops it. */45 background?: string;46 /** Typeface for the copy. Load it yourself; Hanken Grotesk by default. */47 fontFamily?: string;48 /** Size of the phone and lines, around the frame's center. */49 scale?: number;50 /** Frames to hold the first frame before anything moves. */51 delay?: number;52 speed?: number;53 theme?: "light" | "dark";54 ground?: GshPresetId;55 groundParams?: Partial<GradientParams>;56}5758const SW = 390;59const SH = 844;60const BEZEL = 12;61const BW = SW + BEZEL * 2;62const BH = SH + BEZEL * 2;6364const KB_TOP = 524;65const PILL_Y = KB_TOP - 74;66const NOTE_Y = PILL_Y - 16 - 58;67const AMOUNT_Y = 222;68const RING_Y = 290;6970const clamp = { extrapolateLeft: "clamp", extrapolateRight: "clamp" } as const;71const ENTER = Easing.bezier(0.32, 0.72, 0, 1);72const LIGHT = Easing.bezier(0.22, 1, 0.36, 1);73const MOVE = Easing.bezier(0.65, 0, 0.35, 1);74const EXIT = Easing.bezier(0.55, 0, 1, 0.45);75const CAMERA = Easing.bezier(0.87, 0, 0.13, 1);76const HEAVY = { mass: 1, damping: 26, stiffness: 120 };77const CARD = { mass: 0.8, damping: 18, stiffness: 160 };78const CHIP = { mass: 0.5, damping: 12, stiffness: 200 };79const MORPH = { damping: 200 };8081const SYMBOLS: Record<string, string> = {82 USD: "$",83 EUR: "€",84 GBP: "£",85 JPY: "¥",86};8788const DARK = {89 screen: "#050506",90 text: "#f4f4f6",91 muted: "#8b8c94",92 field: "#16171a",93 kb: "#2b2b2d",94 key: "#6b6b6f",95 keyAlt: "#454548",96 keyShadow: "0 1px 0 rgba(0,0,0,0.5)",97 pill: "#f4f4f6",98 pillText: "#0a0a0b",99 pillOff: "#1d1e21",100 pillOffText: "#5d5e65",101 pad: "rgba(255,255,255,0.08)",102 touch: "rgba(255,255,255,0.18)",103 hair: "rgba(255,255,255,0.07)",104 frame:105 "linear-gradient(155deg,#55565c 0%,#2a2b2f 30%,#3d3e43 62%,#1f2023 100%)",106 copy: "#f4f4f6",107 copyMuted: "rgba(244,244,246,0.5)",108 phoneShadow:109 "0 50px 100px -20px rgba(0,0,0,0.7), 0 18px 36px -12px rgba(0,0,0,0.5)",110};111const LIGHT_PAL: typeof DARK = {112 screen: "#fbfbfa",113 text: "#151518",114 muted: "#77777e",115 field: "#f0f0ee",116 kb: "#d2d5da",117 key: "#ffffff",118 keyAlt: "#acb1ba",119 keyShadow: "0 1px 0 rgba(0,0,0,0.28)",120 pill: "#151518",121 pillText: "#ffffff",122 pillOff: "#e6e6e4",123 pillOffText: "#a4a4a9",124 pad: "rgba(21,21,24,0.06)",125 touch: "rgba(21,21,24,0.16)",126 hair: "rgba(21,21,24,0.07)",127 frame:128 "linear-gradient(155deg,#f1f1f3 0%,#c4c4ca 30%,#e2e2e6 62%,#b3b3ba 100%)",129 copy: "#151518",130 copyMuted: "rgba(21,21,24,0.48)",131 phoneShadow:132 "0 50px 90px -24px rgba(30,32,44,0.32), 0 14px 30px -10px rgba(30,32,44,0.18)",133};134type Palette = typeof DARK;135136const NUM_KEYS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "0", "del"];137const NK_W = SW / 3;138const NK_H = 62;139const numRect = (i: number) => ({140 x: (i % 3) * NK_W,141 y: KB_TOP + 24 + Math.floor(i / 3) * (NK_H + 4),142 w: NK_W,143 h: NK_H,144});145146interface QKey {147 id: string;148 x: number;149 y: number;150 w: number;151 label: string;152 alt: boolean;153}154const QW = 32.4;155const QH = 42;156const qRowY = (r: number) => KB_TOP + 52 + r * 54;157const QWERTY: QKey[] = (() => {158 const out: QKey[] = [];159 ["qwertyuiop", "asdfghjkl", "zxcvbnm"].forEach((row, r) => {160 const x0 = (SW - (row.length * QW + (row.length - 1) * 6)) / 2;161 row.split("").forEach((ch, i) => {162 out.push({163 id: ch,164 x: x0 + i * (QW + 6),165 y: qRowY(r),166 w: QW,167 label: ch,168 alt: false,169 });170 });171 });172 const y3 = qRowY(3);173 out.push(174 { id: "shift", x: 6, y: qRowY(2), w: 44, label: "", alt: true },175 { id: "del", x: SW - 50, y: qRowY(2), w: 44, label: "", alt: true },176 { id: "123", x: 6, y: y3, w: 44, label: "123", alt: true },177 { id: "emoji", x: 56, y: y3, w: 44, label: "", alt: true },178 { id: " ", x: 106, y: y3, w: SW - 204, label: "space", alt: false },179 { id: "return", x: SW - 92, y: y3, w: 86, label: "return", alt: true },180 );181 return out;182})();183184const ICON = {185 back: "M19 12H5M11 6l-6 6 6 6",186 del: "M9 6h11a1 1 0 011 1v10a1 1 0 01-1 1H9l-6-6zM12.5 9.5l5 5M17.5 9.5l-5 5",187 left: "M14.5 6l-6 6 6 6",188 shift: "M12 4l8 8h-4.5v7h-7v-7H4z",189 smile:190 "M12 3a9 9 0 110 18 9 9 0 010-18zM8.5 14.5c1.8 2 5.2 2 7 0M9 9.5h.01M15 9.5h.01",191 chev: "M7 10l5 5 5-5",192 check: "M7 12.5l3.5 3.5L17 9",193 globe:194 "M12 3a9 9 0 110 18 9 9 0 010-18zM3 12h18M12 3c2.5 2.6 3.6 5.6 3.6 9s-1.1 6.4-3.6 9c-2.5-2.6-3.6-5.6-3.6-9s1.1-6.4 3.6-9z",195 mic: "M12 3a3 3 0 013 3v6a3 3 0 01-6 0V6a3 3 0 013-3zM5.5 11a6.5 6.5 0 0013 0M12 17.5V21",196 x: "M9 9l6 6M15 9l-6 6",197 share: "M12 15V4M8 8l4-4 4 4M5 13v6h14v-6",198};199200function balloon(w: number, kw: number, kh: number) {201 const dx = (w - kw) / 2;202 const head = 50;203 const neck = 12;204 const h = head + neck + kh;205 return {206 h,207 d: `M0 9Q0 0 9 0H${w - 9}Q${w} 0 ${w} 9V${head}C${w} ${head + neck * 0.6} ${w - dx} ${head + neck * 0.4} ${w - dx} ${head + neck}V${h - 6}Q${w - dx} ${h} ${w - dx - 6} ${h}H${dx + 6}Q${dx} ${h} ${dx} ${h - 6}V${head + neck}C${dx} ${head + neck * 0.4} 0 ${head + neck * 0.6} 0 ${head}Z`,208 };209}210211function Glyph({212 d,213 size = 20,214 color,215 sw = 1.5,216}: {217 d: string;218 size?: number;219 color: string;220 sw?: number;221}) {222 return (223 <svg width={size} height={size} viewBox="0 0 24 24" fill="none">224 <path225 d={d}226 stroke={color}227 strokeWidth={sw}228 strokeLinecap="round"229 strokeLinejoin="round"230 />231 </svg>232 );233}234235function splitNote(note: string) {236 const chars = Array.from(note);237 const idx = chars.findIndex((ch) => (ch.codePointAt(0) ?? 0) > 0x2100);238 if (idx < 0) return { word: chars, emoji: "" };239 return {240 word: Array.from(chars.slice(0, idx).join("").trimEnd()),241 emoji: chars.slice(idx).join("").trim(),242 };243}244245function StatusBar({ color }: { color: string }) {246 return (247 <div248 style={{249 position: "absolute",250 top: 0,251 left: 0,252 right: 0,253 height: 54,254 display: "flex",255 alignItems: "center",256 justifyContent: "space-between",257 padding: "4px 30px 0 52px",258 zIndex: 30,259 }}260 >261 <span style={{ fontSize: 17, fontWeight: 400, color }}>9:41</span>262 <div style={{ display: "flex", gap: 6, alignItems: "center" }}>263 <svg width="18" height="12" viewBox="0 0 18 12">264 {[0, 1, 2, 3].map((i) => (265 <rect266 key={i}267 x={i * 4.6}268 y={9 - i * 3}269 width={3.2}270 height={3 + i * 3}271 rx={0.8}272 fill={color}273 />274 ))}275 </svg>276 <svg width="17" height="12" viewBox="0 0 17 12">277 <path278 d="M8.5 11.5l2.4-2.9a3.6 3.6 0 00-4.8 0zM3.7 6.2a7 7 0 019.6 0l1.6-1.9a9.6 9.6 0 00-12.8 0zM.5 2.9a12 12 0 0116 0"279 fill={color}280 stroke={color}281 strokeWidth={0.6}282 />283 </svg>284 <div285 style={{286 width: 26,287 height: 12.5,288 borderRadius: 4,289 border: `1px solid ${color}`,290 padding: 1.5,291 boxSizing: "border-box",292 }}293 >294 <div295 style={{296 width: "80%",297 height: "100%",298 borderRadius: 2,299 background: color,300 }}301 />302 </div>303 </div>304 </div>305 );306}307308function Phone({ children, c }: { children: React.ReactNode; c: Palette }) {309 const side = (s: "left" | "right", top: number, h: number) => (310 <div311 style={{312 position: "absolute",313 [s]: -2.5,314 top,315 width: 4,316 height: h,317 borderRadius: 2,318 background: c.frame,319 }}320 />321 );322 return (323 <div style={{ position: "relative", width: BW, height: BH }}>324 {side("left", 168, 30)}325 {side("left", 226, 60)}326 {side("left", 298, 60)}327 {side("right", 258, 96)}328 <div329 style={{330 position: "absolute",331 inset: 0,332 borderRadius: 67,333 background: c.frame,334 boxShadow: `${c.phoneShadow}, inset 0 0 0 1px rgba(255,255,255,0.22)`,335 }}336 />337 <div338 style={{339 position: "absolute",340 inset: 3.5,341 borderRadius: 63.5,342 background: "#050506",343 }}344 />345 <div346 style={{347 position: "absolute",348 left: BEZEL,349 top: BEZEL,350 width: SW,351 height: SH,352 borderRadius: 55,353 overflow: "hidden",354 background: c.screen,355 }}356 >357 {children}358 <div359 style={{360 position: "absolute",361 top: 11,362 left: (SW - 124) / 2,363 width: 124,364 height: 36,365 borderRadius: 18,366 background: "#000",367 zIndex: 40,368 }}369 />370 <div371 style={{372 position: "absolute",373 bottom: 8,374 left: (SW - 136) / 2,375 width: 136,376 height: 5,377 borderRadius: 3,378 background: c.text,379 zIndex: 40,380 }}381 />382 </div>383 </div>384 );385}386387function Avatar({ initials, size }: { initials: string; size: number }) {388 return (389 <div390 style={{391 width: size,392 height: size,393 borderRadius: size / 2,394 background: "#c98a68",395 boxShadow: "inset 0 0 0 1px rgba(0,0,0,0.08)",396 color: "#fff8f2",397 fontSize: size * 0.36,398 fontWeight: 400,399 display: "flex",400 alignItems: "center",401 justifyContent: "center",402 flexShrink: 0,403 }}404 >405 {initials}406 </div>407 );408}409410function Flag({ currency, color }: { currency: string; color: string }) {411 const id = `flag${useId().replace(/[^a-zA-Z0-9_-]/g, "")}`;412 if (currency !== "USD") {413 return (414 <div415 style={{416 width: 20,417 height: 20,418 borderRadius: 10,419 background: color,420 color: "#fff",421 fontSize: 11,422 display: "flex",423 alignItems: "center",424 justifyContent: "center",425 }}426 >427 {SYMBOLS[currency] ?? currency[0]}428 </div>429 );430 }431 return (432 <svg width={20} height={20} viewBox="0 0 20 20">433 <defs>434 <clipPath id={id}>435 <circle cx={10} cy={10} r={10} />436 </clipPath>437 </defs>438 <g clipPath={`url(#${id})`}>439 <rect width={20} height={20} fill="#fff" />440 {[0, 2, 4, 6, 8, 10, 12].map((i) => (441 <rect key={i} y={i * 1.54} width={20} height={1.54} fill="#d22f3c" />442 ))}443 <rect width={10} height={10.8} fill="#2a3b84" />444 </g>445 </svg>446 );447}448449/** The foreground at `scale`, around the frame's center; nothing extra at 1. */450function ScaleLayer({451 scale,452 children,453}: {454 scale: number;455 children: React.ReactNode;456}) {457 if (scale === 1) return children;458 return (459 <AbsoluteFill style={{ transform: `scale(${scale})` }}>460 {children}461 </AbsoluteFill>462 );463}464465export function MoneySend({466 recipient = "Maya Chen",467 amount = 120,468 currency = "USD",469 note = "Dinner 🍜",470 lines = ["Type any amount.", "Say what it’s for.", "Sent in a second."],471 notePlaceholder = "Add a note",472 doneLabel = "Done",473 stagger = 11,474 accent = "#3B5BFD",475 ink,476 background,477 fontFamily = hanken.fontFamily,478 scale = 1,479 delay = 0,480 speed = 1,481 theme = "dark",482 ground,483 groundParams,484}: MoneySendProps) {485 const frame = Math.max(0, useCurrentFrame() - delay);486 const { fps, width, height } = useVideoConfig();487 const f = frame * speed;488 const dark = theme !== "light";489 const c: Palette = dark ? DARK : LIGHT_PAL;490 const fg = ink ?? c.copy;491 const tall = height > width;492 const W = tall ? 720 : 1280;493 const H = tall ? 1280 : 720;494 const u = Math.min(width / W, height / H);495 const k = tall ? (H * 0.74) / BH : (H * 0.94) / BH;496 const phoneCx = tall ? W / 2 : W * 0.665;497 const phoneCy = tall ? H - 36 - (BH * k) / 2 : H / 2;498499 const sp = (at: number, config: typeof CARD | typeof MORPH = CARD) =>500 spring({ frame: f - at, fps, config });501 const pressAt = (at: number) =>502 spring({ frame: f - at, fps, config: CHIP }) -503 spring({ frame: f - at - 4, fps, config: CHIP });504505 const digits = String(Math.max(1, Math.round(amount))).slice(0, 6);506 const symbol = SYMBOLS[currency] ?? "";507 const { word, emoji } = splitNote(note);508 const first = recipient.split(" ")[0];509 const initials = recipient510 .split(" ")511 .map((s) => s[0] ?? "")512 .join("")513 .slice(0, 2)514 .toUpperCase();515516 const keyTimes = digits.split("").map((_, i) => 30 + i * stagger);517 const NOTE_TAP = keyTimes[keyTimes.length - 1] + 22;518 const KB_SWAP = NOTE_TAP + 3;519 const gap = Math.min(5, 36 / Math.max(1, word.length));520 const letterTimes = word.map((_, i) => KB_SWAP + 18 + i * gap);521 const typeEnd = letterTimes.length522 ? letterTimes[letterTimes.length - 1]523 : KB_SWAP + 12;524 const SUGG_TAP = emoji ? typeEnd + 11 : typeEnd;525 const SEND_TAP = SUGG_TAP + 18;526 const FLY = SEND_TAP + 3;527 const PROG = SEND_TAP + 6;528 const DONE = PROG + 30;529530 const nTyped = keyTimes.filter((t) => f >= t).length;531 const nLetters = letterTimes.filter((t) => f >= t).length;532 const emojiIn = emoji ? sp(SUGG_TAP, CHIP) : 0;533 const noteFocused = f >= NOTE_TAP;534535 const numCenter = (d: string) => {536 const r = numRect(d === "0" ? 10 : Number(d) - 1);537 return { x: r.x + r.w / 2, y: r.y + r.h / 2 + 4 };538 };539 const letterKey = (ch: string) =>540 QWERTY.find((q) => q.id === ch.toLowerCase()) ??541 (QWERTY.find((q) => q.id === " ") as QKey);542 const presses = [543 ...digits.split("").map((d, i) => ({ t: keyTimes[i], ...numCenter(d) })),544 { t: NOTE_TAP, x: SW / 2 + 50, y: NOTE_Y + 30 },545 ...word.map((ch, i) => {546 const q = letterKey(ch);547 return { t: letterTimes[i], x: q.x + q.w / 2, y: q.y + QH / 2 + 6 };548 }),549 ...(emoji ? [{ t: SUGG_TAP, x: SW / 2, y: KB_TOP + 24 }] : []),550 { t: SEND_TAP, x: SW / 2 + 36, y: PILL_Y + 28 },551 ];552 const path = [553 { t: presses[0].t - 16, x: presses[0].x + 70, y: presses[0].y + 120 },554 ...presses,555 ];556 let touch = { x: path[0].x, y: path[0].y };557 for (let i = 0; i < path.length - 1; i++) {558 const a = path[i];559 const b = path[i + 1];560 const start = a.t + 1.5;561 const end = Math.max(start + 1, b.t - 1);562 if (f >= start) {563 const p = Math.min(1, (f - start) / (end - start));564 const e = MOVE(p);565 const dist = Math.hypot(b.x - a.x, b.y - a.y);566 const lift = Math.sin(Math.PI * e) * Math.min(28, dist * 0.18);567 const nx = dist ? -(b.y - a.y) / dist : 0;568 const ny = dist ? (b.x - a.x) / dist : 0;569 touch = {570 x: a.x + (b.x - a.x) * e + nx * lift,571 y: a.y + (b.y - a.y) * e + ny * lift,572 };573 }574 }575 const touchOpacity = interpolate(576 f,577 [path[0].t, path[0].t + 8, SEND_TAP + 2, SEND_TAP + 7],578 [0, 1, 1, 0],579 clamp,580 );581 const touchPress = Math.max(...presses.map((p) => pressAt(p.t)));582583 const kbOut = interpolate(f, [KB_SWAP, KB_SWAP + 8], [0, 1], {584 ...clamp,585 easing: EXIT,586 });587 const qIn = f >= KB_SWAP + 5 ? sp(KB_SWAP + 5, MORPH) : 0;588 const fly = sp(FLY, MORPH);589 const kbDown = interpolate(f, [SEND_TAP + 2, SEND_TAP + 11], [0, 1], {590 ...clamp,591 easing: ENTER,592 });593 const qY = (1 - qIn) * (SH - KB_TOP) + kbDown * (SH - KB_TOP);594 const caps = nLetters === 0 && word[0] === word[0]?.toUpperCase();595 const lastLetter = nLetters - 1;596597 const rise = spring({ frame: f, fps, config: HEAVY });598 const camS = interpolate(f, [16, 70, FLY, FLY + 50], [1, 1.03, 1.03, 1.05], {599 ...clamp,600 easing: CAMERA,601 });602603 const enabled = interpolate(f, [keyTimes[0], keyTimes[0] + 6], [0, 1], {604 ...clamp,605 easing: ENTER,606 });607 const sendPress = pressAt(SEND_TAP);608 const away = interpolate(f, [SEND_TAP + 2, SEND_TAP + 9], [0, 1], {609 ...clamp,610 easing: EXIT,611 });612 const lbl = interpolate(f, [NOTE_TAP, NOTE_TAP + 6], [0, 1], {613 ...clamp,614 easing: ENTER,615 });616 const typed = nTyped === 0 ? "0" : digits.slice(0, nTyped);617 const amountChars = Number(typed)618 .toLocaleString("en-US")619 .split("")620 .reduce<{ ch: string; di: number }[]>((acc, ch) => {621 const di = acc.filter((a) => a.di >= 0).length;622 acc.push({ ch, di: ch === "," ? -1 : di });623 return acc;624 }, []);625 const money = (n: number) =>626 `${symbol}${n.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}${symbol ? "" : ` ${currency}`}`;627 const caretOn = f < NOTE_TAP && Math.floor((f + 6) / 14) % 2 === 0;628629 const ringIn = sp(PROG, CARD);630 const arc = interpolate(f, [PROG, DONE - 4, DONE + 2], [0.12, 0.7, 1], {631 ...clamp,632 easing: MOVE,633 });634 const spin = f < DONE ? (f - PROG) * 11 : (DONE - PROG) * 11;635 const disc = sp(DONE + 1, CHIP);636 const tick = interpolate(f, [DONE + 5, DONE + 15], [0, 1], {637 ...clamp,638 easing: LIGHT,639 });640 const pulse = interpolate(f, [DONE + 6, DONE + 40], [0, 1], {641 ...clamp,642 easing: LIGHT,643 });644 const title = sp(PROG + 4);645 const swap = sp(DONE + 4, CHIP);646 const sub = sp(DONE + 8);647 const done = sp(DONE + 24);648 const receipt: [string, string][] = [649 ["Amount", money(Number(digits))],650 ["From", `Main · ${currency}`],651 ["Arrives", "Instantly"],652 ["Fee", money(0)],653 ];654 const rows = receipt.map((_, i) => sp(DONE + 12 + i * 3));655 const enter = (v: number, dy = 14): React.CSSProperties => ({656 opacity: Math.min(1, v * 1.4),657 transform: `translateY(${(1 - v) * dy}px)`,658 });659660 const beats = [0, NOTE_TAP, PROG];661 const copyLine = (i: number) => {662 const inAt = beats[i] + (i === 0 ? 6 : 0);663 const outAt = beats[i + 1];664 const pin = interpolate(f, [inAt, inAt + 14], [0, 1], {665 ...clamp,666 easing: ENTER,667 });668 const pout =669 outAt === undefined670 ? 0671 : interpolate(f, [outAt - 2, outAt + 6], [0, 1], {672 ...clamp,673 easing: EXIT,674 });675 if (pin <= 0 || pout >= 1) return null;676 return (677 <div678 key={i}679 style={{680 position: "absolute",681 left: 0,682 right: 0,683 top: 0,684 transform: `translateY(${(1 - pin) * 70 - pout * 50}%)`,685 opacity: pin * (1 - pout),686 }}687 >688 {lines[i]}689 </div>690 );691 };692693 const keyStyle = (694 x: number,695 y: number,696 w: number,697 h: number,698 bg: string,699 ): React.CSSProperties => ({700 position: "absolute",701 left: x,702 top: y,703 width: w,704 height: h,705 borderRadius: 7,706 background: bg,707 boxShadow: c.keyShadow,708 color: c.text,709 display: "flex",710 flexDirection: "column",711 alignItems: "center",712 justifyContent: "center",713 });714715 return (716 <AbsoluteFill style={{ fontFamily, overflow: "hidden" }}>717 {background === undefined ? (718 <>719 <GshGround720 preset={ground ?? (dark ? "cobalt-rise" : "paper-crease")}721 params={groundParams}722 timeOffset={dark ? 4 : 6}723 timeScale={0.35}724 />725 <AbsoluteFill726 style={{727 background: dark ? "rgba(2,3,8,0.32)" : "rgba(243,241,237,0.35)",728 }}729 />730 </>731 ) : (732 <AbsoluteFill733 style={{734 background: background === "transparent" ? undefined : background,735 }}736 />737 )}738 <ScaleLayer scale={scale}>739 <div740 style={{741 position: "absolute",742 left: (width - W * u) / 2,743 top: (height - H * u) / 2,744 width: W,745 height: H,746 transformOrigin: "0 0",747 transform: `scale(${u})`,748 }}749 >750 <div751 style={{752 position: "absolute",753 left: tall ? 56 : 92,754 top: tall ? 88 : H / 2 - 80,755 width: tall ? W - 112 : 500,756 height: 160,757 fontSize: tall ? 60 : 72,758 fontWeight: 300,759 lineHeight: 1.04,760 letterSpacing: "-0.035em",761 color: fg,762 overflow: "hidden",763 textWrap: "balance",764 }}765 >766 {[0, 1, 2].map((i) => copyLine(i))}767 </div>768 <div769 style={{770 position: "absolute",771 left: phoneCx - BW / 2,772 top: phoneCy - BH / 2,773 width: BW,774 height: BH,775 transform: `translateY(${(1 - rise) * H * 0.9}px) scale(${k * camS})`,776 }}777 >778 <Phone c={c}>779 <StatusBar color={c.text} />780 <div781 style={{782 position: "absolute",783 top: 58,784 left: 20,785 right: 20,786 height: 44,787 display: "flex",788 alignItems: "center",789 justifyContent: "space-between",790 opacity: 1 - away,791 transform: `translateY(${-away * 8}px)`,792 }}793 >794 <Glyph d={ICON.back} size={24} color={c.text} />795 <div style={{ textAlign: "center", lineHeight: 1.25 }}>796 <div style={{ fontSize: 17, color: c.text }}>{recipient}</div>797 <div style={{ fontSize: 14, color: c.muted }}>798 @{recipient.toLowerCase().replace(/[^a-z]+/g, "")}799 </div>800 </div>801 <Avatar initials={initials} size={36} />802 </div>803 <div804 style={{805 position: "absolute",806 left: 0,807 right: 0,808 top: AMOUNT_Y - 50,809 height: 100,810 display: "flex",811 alignItems: "center",812 justifyContent: "center",813 fontSize: 92,814 fontWeight: 300,815 letterSpacing: "-0.05em",816 fontVariantNumeric: "tabular-nums",817 color: nTyped ? c.text : c.muted,818 transform: `translateY(${fly * (118 - AMOUNT_Y)}px) scale(${1 - fly * 0.5})`,819 zIndex: 5,820 }}821 >822 <span>{symbol}</span>823 {amountChars.map(({ ch, di }, i) => {824 const pop = nTyped && di >= 0 ? sp(keyTimes[di], CHIP) : 1;825 return (826 <span827 key={i}828 style={{829 display: "inline-block",830 width: `${(ch === "," ? 0.26 : 0.56) * Math.min(1, pop * 1.3)}em`,831 textAlign: "center",832 transform: `translateY(${(1 - pop) * 18}px) scale(${0.88 + pop * 0.12})`,833 opacity: Math.min(1, pop * 1.6),834 }}835 >836 {ch}837 </span>838 );839 })}840 <span841 style={{842 width: 3,843 height: 70,844 marginLeft: 6,845 borderRadius: 2,846 background: accent,847 opacity: caretOn ? 1 : 0,848 }}849 />850 </div>851 <div852 style={{853 position: "absolute",854 left: 0,855 right: 0,856 top: AMOUNT_Y + 56,857 display: "flex",858 justifyContent: "center",859 opacity: 1 - away,860 transform: `translateY(${-away * 10}px)`,861 }}862 >863 <div864 style={{865 height: 36,866 padding: "0 12px 0 8px",867 borderRadius: 18,868 background: c.field,869 display: "flex",870 alignItems: "center",871 gap: 8,872 fontSize: 15,873 color: c.text,874 }}875 >876 <Flag currency={currency} color={c.muted} />877 Main · {currency}878 <span style={{ color: c.muted }}>No fees</span>879 <Glyph d={ICON.chev} size={16} color={c.muted} />880 </div>881 </div>882 <div883 style={{884 position: "absolute",885 left: 16,886 right: 16,887 top: NOTE_Y,888 height: 58,889 borderRadius: 14,890 background: c.field,891 opacity: 1 - away,892 transform: `translateY(${-away * 10}px) scale(${1 - pressAt(NOTE_TAP) * 0.03})`,893 }}894 >895 <span896 style={{897 position: "absolute",898 left: 16,899 top: 18,900 fontSize: 17,901 lineHeight: "22px",902 color: c.muted,903 transformOrigin: "0 0",904 transform: `translateY(${-lbl * 10}px) scale(${1 - lbl * 0.3})`,905 }}906 >907 {notePlaceholder}908 </span>909 {noteFocused ? (910 <span911 style={{912 position: "absolute",913 left: 16,914 top: 26,915 fontSize: 17,916 lineHeight: "22px",917 color: c.text,918 display: "flex",919 alignItems: "center",920 opacity: lbl,921 }}922 >923 {word.slice(0, nLetters).join("")}924 {emojiIn > 0 ? (925 <span926 style={{927 display: "inline-block",928 marginLeft: 5,929 transform: `scale(${0.5 + emojiIn * 0.5})`,930 opacity: Math.min(1, emojiIn * 2),931 }}932 >933 {emoji}934 </span>935 ) : null}936 <span937 style={{938 width: 2,939 height: 21,940 marginLeft: 1,941 borderRadius: 1,942 background: accent,943 opacity: Math.floor(f / 14) % 2 === 0 ? 1 : 0,944 }}945 />946 </span>947 ) : null}948 <div949 style={{950 position: "absolute",951 right: 16,952 top: 19,953 width: 20,954 height: 20,955 borderRadius: 10,956 background: c.muted,957 display: "flex",958 alignItems: "center",959 justifyContent: "center",960 opacity: nLetters > 0 ? 0.6 : 0,961 }}962 >963 <Glyph d={ICON.x} size={14} color={c.field} sw={2} />964 </div>965 </div>966 <div967 style={{968 position: "absolute",969 left: 16,970 right: 16,971 top: PILL_Y,972 height: 56,973 borderRadius: 28,974 background: interpolateColors(975 enabled,976 [0, 1],977 [c.pillOff, c.pill],978 ),979 color: interpolateColors(980 enabled,981 [0, 1],982 [c.pillOffText, c.pillText],983 ),984 fontSize: 17,985 display: "flex",986 alignItems: "center",987 justifyContent: "center",988 transform: `translateY(${-away * 10}px) scale(${1 - sendPress * 0.04})`,989 opacity: 1 - away,990 }}991 >992 Send to {first}993 </div>994 {NUM_KEYS.map((d, i) => {995 const r = numRect(i);996 const idx = digits997 .split("")998 .findIndex(999 (x, j) =>1000 x === d && f >= keyTimes[j] - 1 && f < keyTimes[j] + 10,1001 );1002 const p = idx >= 0 ? pressAt(keyTimes[idx]) : 0;1003 return (1004 <div1005 key={d}1006 style={{1007 position: "absolute",1008 left: r.x,1009 top: r.y + kbOut * (SH - KB_TOP),1010 width: r.w,1011 height: r.h,1012 display: "flex",1013 alignItems: "center",1014 justifyContent: "center",1015 color: c.text,1016 }}1017 >1018 <div1019 style={{1020 position: "absolute",1021 width: 64,1022 height: 64,1023 borderRadius: 32,1024 background: c.pad,1025 opacity: Math.min(1, p * 3),1026 transform: `scale(${0.7 + p * 0.3})`,1027 }}1028 />1029 {d === "del" ? (1030 <Glyph d={ICON.left} size={26} color={c.text} />1031 ) : (1032 <span1033 style={{1034 position: "relative",1035 fontSize: 30,1036 fontWeight: 300,1037 transform: `scale(${1 - p * 0.04})`,1038 }}1039 >1040 {d === "." ? "·" : d}1041 </span>1042 )}1043 </div>1044 );1045 })}1046 {qIn > 0 ? (1047 <div1048 style={{1049 position: "absolute",1050 left: 0,1051 right: 0,1052 top: KB_TOP,1053 bottom: 0,1054 background: c.kb,1055 transform: `translateY(${qY}px)`,1056 }}1057 >1058 <div1059 style={{1060 display: "flex",1061 height: 44,1062 alignItems: "center",1063 fontSize: 16,1064 color: c.text,1065 }}1066 >1067 {[1068 `“${word.slice(0, nLetters).join("")}”`,1069 nLetters >= 3 && emoji ? emoji : word.join(""),1070 "with",1071 ].map((s, i) => (1072 <div1073 key={i}1074 style={{1075 flex: 1,1076 textAlign: "center",1077 fontSize: i === 1 && nLetters >= 3 ? 22 : 16,1078 borderLeft:1079 i > 01080 ? `1px solid ${c.keyAlt}`1081 : "1px solid transparent",1082 height: 24,1083 lineHeight: "24px",1084 opacity: i === 1 ? 1 - pressAt(SUGG_TAP) * 0.5 : 0.9,1085 }}1086 >1087 {s}1088 </div>1089 ))}1090 </div>1091 {QWERTY.map((q) => {1092 const hit = word.findIndex(1093 (ch, i) =>1094 letterKey(ch).id === q.id &&1095 f >= letterTimes[i] - 1 &&1096 f < letterTimes[i] + 7,1097 );1098 const p = hit >= 0 ? pressAt(letterTimes[hit]) : 0;1099 const shiftOn = q.id === "shift" && caps;1100 return (1101 <div1102 key={q.id}1103 style={{1104 ...keyStyle(1105 q.x,1106 q.y - KB_TOP,1107 q.w,1108 QH,1109 shiftOn ? c.key : q.alt ? c.keyAlt : c.key,1110 ),1111 filter:1112 p > 0.3 && q.id === " "1113 ? "brightness(1.3)"1114 : "none",1115 fontSize: q.alt || q.id === " " ? 15 : 22,1116 }}1117 >1118 {q.id === "shift" ? (1119 <Glyph d={ICON.shift} size={20} color={c.text} />1120 ) : q.id === "del" ? (1121 <Glyph d={ICON.del} size={22} color={c.text} />1122 ) : q.id === "emoji" ? (1123 <Glyph d={ICON.smile} size={22} color={c.text} />1124 ) : caps && !q.alt ? (1125 q.label.toUpperCase()1126 ) : (1127 q.label1128 )}1129 </div>1130 );1131 })}1132 {[ICON.globe, ICON.mic].map((d, i) => (1133 <div1134 key={d}1135 style={{1136 position: "absolute",1137 left: i ? SW - 46 : 22,1138 top: qRowY(3) - KB_TOP + QH + 18,1139 }}1140 >1141 <Glyph d={d} size={24} color={c.text} />1142 </div>1143 ))}1144 {lastLetter >= 0 && pressAt(letterTimes[lastLetter]) > 0.051145 ? (() => {1146 const q = letterKey(word[lastLetter]);1147 if (q.id === " ") return null;1148 const bw = q.w + 22;1149 const bl = balloon(bw, q.w, QH);1150 return (1151 <div1152 style={{1153 position: "absolute",1154 left: q.x - 11,1155 top: q.y - KB_TOP + QH - bl.h,1156 width: bw,1157 height: bl.h,1158 filter: "drop-shadow(0 1px 3px rgba(0,0,0,0.3))",1159 }}1160 >1161 <svg1162 width={bw}1163 height={bl.h}1164 style={{ position: "absolute" }}1165 >1166 <path d={bl.d} fill={c.key} />1167 </svg>1168 <div1169 style={{1170 position: "absolute",1171 left: 0,1172 right: 0,1173 top: 4,1174 height: 44,1175 color: c.text,1176 fontSize: 32,1177 display: "flex",1178 alignItems: "center",1179 justifyContent: "center",1180 }}1181 >1182 {word[lastLetter]}1183 </div>1184 </div>1185 );1186 })()1187 : null}1188 </div>1189 ) : null}1190 {f >= PROG ? (1191 <>1192 <div1193 style={{1194 position: "absolute",1195 left: SW / 2 - 60,1196 top: RING_Y - 60,1197 width: 120,1198 height: 120,1199 transform: `scale(${0.86 + ringIn * 0.14})`,1200 opacity: Math.min(1, ringIn * 1.6),1201 }}1202 >1203 <svg1204 width={120}1205 height={120}1206 viewBox="0 0 120 120"1207 style={{1208 position: "absolute",1209 inset: 0,1210 overflow: "visible",1211 }}1212 >1213 <circle1214 cx={60}1215 cy={60}1216 r={46 + pulse * 40}1217 fill="none"1218 stroke={accent}1219 strokeWidth={1.5}1220 opacity={(1 - pulse) * 0.4 * (pulse > 0 ? 1 : 0)}1221 />1222 <circle1223 cx={60}1224 cy={60}1225 r={46}1226 fill="none"1227 stroke={c.field}1228 strokeWidth={3}1229 />1230 <circle1231 cx={60}1232 cy={60}1233 r={46}1234 fill="none"1235 stroke={accent}1236 strokeWidth={3}1237 strokeLinecap="round"1238 pathLength={1}1239 strokeDasharray={`${arc} 1`}1240 transform={`rotate(${spin - 90} 60 60)`}1241 />1242 </svg>1243 <div style={{ position: "absolute", left: 22, top: 22 }}>1244 <Avatar initials={initials} size={76} />1245 </div>1246 <div1247 style={{1248 position: "absolute",1249 left: 14,1250 top: 14,1251 width: 92,1252 height: 92,1253 borderRadius: 46,1254 background: accent,1255 transform: `scale(${0.5 + disc * 0.5})`,1256 opacity: Math.min(1, disc * 2.5),1257 display: "flex",1258 alignItems: "center",1259 justifyContent: "center",1260 }}1261 >1262 <svg1263 width={52}1264 height={52}1265 viewBox="0 0 24 24"1266 fill="none"1267 >1268 <path1269 d={ICON.check}1270 stroke="#fff"1271 strokeWidth={1.8}1272 strokeLinecap="round"1273 strokeLinejoin="round"1274 pathLength={1}1275 strokeDasharray={1}1276 strokeDashoffset={1 - tick}1277 />1278 </svg>1279 </div>1280 </div>1281 <div1282 style={{1283 position: "absolute",1284 left: 0,1285 right: 0,1286 top: RING_Y + 82,1287 textAlign: "center",1288 fontSize: 30,1289 fontWeight: 300,1290 letterSpacing: "-0.03em",1291 color: c.text,1292 ...enter(title),1293 }}1294 >1295 <span1296 style={{1297 display: "inline-block",1298 opacity: f < DONE + 4 ? 0.55 : Math.min(1, swap * 1.5),1299 transform: `scale(${f < DONE + 4 ? 1 : 0.92 + swap * 0.08})`,1300 }}1301 >1302 {f < DONE + 41303 ? `Sending to ${first}…`1304 : `Sent to ${first}`}1305 </span>1306 </div>1307 <div1308 style={{1309 position: "absolute",1310 left: 0,1311 right: 0,1312 top: RING_Y + 124,1313 textAlign: "center",1314 fontSize: 15,1315 color: c.muted,1316 ...enter(sub),1317 }}1318 >1319 {note} · Just now1320 </div>1321 <div1322 style={{1323 position: "absolute",1324 left: 16,1325 right: 16,1326 top: RING_Y + 170,1327 borderRadius: 16,1328 background: c.field,1329 padding: "2px 16px",1330 opacity: Math.min(1, rows[0] * 2),1331 }}1332 >1333 {receipt.map(([kk, v], i) => (1334 <div1335 key={kk}1336 style={{1337 height: 46,1338 display: "flex",1339 alignItems: "center",1340 justifyContent: "space-between",1341 fontSize: 15,1342 boxShadow: i ? `inset 0 1px 0 ${c.hair}` : "none",1343 ...enter(rows[i], 10),1344 }}1345 >1346 <span style={{ color: c.muted }}>{kk}</span>1347 <span1348 style={{1349 color: c.text,1350 fontVariantNumeric: "tabular-nums",1351 }}1352 >1353 {v}1354 </span>1355 </div>1356 ))}1357 </div>1358 <div1359 style={{1360 position: "absolute",1361 left: 16,1362 right: 16,1363 bottom: 40,1364 display: "flex",1365 gap: 10,1366 ...enter(done, 24),1367 }}1368 >1369 <div1370 style={{1371 width: 56,1372 height: 56,1373 borderRadius: 28,1374 background: c.field,1375 display: "flex",1376 alignItems: "center",1377 justifyContent: "center",1378 }}1379 >1380 <Glyph d={ICON.share} size={22} color={c.text} />1381 </div>1382 <div1383 style={{1384 flex: 1,1385 height: 56,1386 borderRadius: 28,1387 background: c.pill,1388 color: c.pillText,1389 fontSize: 17,1390 display: "flex",1391 alignItems: "center",1392 justifyContent: "center",1393 }}1394 >1395 {doneLabel}1396 </div>1397 </div>1398 </>1399 ) : null}1400 <div1401 style={{1402 position: "absolute",1403 left: touch.x - 22,1404 top: touch.y - 22,1405 width: 44,1406 height: 44,1407 borderRadius: 22,1408 background: c.touch,1409 boxShadow:1410 "inset 0 0 0 1.5px rgba(255,255,255,0.7), 0 2px 10px rgba(0,0,0,0.2)",1411 opacity: touchOpacity,1412 transform: `scale(${1 - touchPress * 0.12})`,1413 zIndex: 35,1414 }}1415 />1416 </Phone>1417 </div>1418 </div>1419 </ScaleLayer>1420 </AbsoluteFill>1421 );1422}









