Multi File Drop
Files drop into a prompt box as chips, then a cursor presses send.
Source
components/kuchi/multi-file-drop.tsx
1"use client";23import { loadFont as loadHanken } from "@remotion/google-fonts/HankenGrotesk";4import { loadFont as loadJetBrains } from "@remotion/google-fonts/JetBrainsMono";5import type React from "react";6import {7 AbsoluteFill,8 Easing,9 Img,10 interpolate,11 random,12 spring,13 useCurrentFrame,14 useVideoConfig,15} from "remotion";16import type { GradientParams } from "@/lib/kuchi/gsh/gradient-engine";17import { GshGround } from "@/lib/kuchi/gsh/gsh-ground";18import type { GshPresetId } from "@/lib/kuchi/gsh/presets";1920const hanken = loadHanken("normal", {21 weights: ["300", "400"],22 subsets: ["latin"],23});24const mono = loadJetBrains("normal", {25 weights: ["400"],26 subsets: ["latin"],27});2829const ENTER = Easing.bezier(0.32, 0.72, 0, 1);30const EXIT = Easing.bezier(0.55, 0, 1, 0.45);31const MOVE = Easing.bezier(0.65, 0, 0.35, 1);32const SWAY = Easing.bezier(0.45, 0, 0.55, 1);33const HEAVY = { mass: 1, damping: 26, stiffness: 120 };34const CARD = { mass: 0.8, damping: 18, stiffness: 160 };35const CHIP = { mass: 0.5, damping: 12, stiffness: 200 };36const MORPH = { damping: 200 };3738const B = {39 head: -12,40 card: -8,41 fly: 4,42 hover: 26,43 drop: 38,44 deal: 40,45 dealStep: 2,46 land: 10,47 resolve: [62, 74, 84, 92],48 cursorOut: 52,49 ready: 100,50 send: 112,51 leave: 122,52 end: 144,53};5455export const MULTI_FILE_DROP_DURATION = B.end;5657const ramp = (f: number, start: number, dur: number, easing = ENTER) =>58 interpolate(f, [start, start + dur], [0, 1], {59 extrapolateLeft: "clamp",60 extrapolateRight: "clamp",61 easing,62 });6364const mix = (a: number, b: number, t: number) => a + (b - a) * t;6566export type DropFileKind = "image" | "sketch" | "doc" | "sheet";67export interface DropFile {68 name: string;69 kind: DropFileKind;70 src?: string;71 size?: string;72}7374const DEFAULT_FILES: DropFile[] = [75 { name: "wireframe.png", kind: "sketch" },76 {77 name: "hero.jpg",78 kind: "image",79 src: "https://kuchi-media.kalarislabs.com/components/art/art-03.svg",80 },81 { name: "brief.pdf", kind: "doc", size: "412 KB" },82 { name: "pricing.csv", kind: "sheet", size: "18 KB" },83];8485const FAN = [86 { x: -96, y: 18, r: -12 },87 { x: -34, y: -8, r: -4 },88 { x: 30, y: -2, r: 5 },89 { x: 92, y: 20, r: 12 },90];9192function Progress({93 size,94 color,95 value,96}: {97 size: number;98 color: string;99 value: number;100}) {101 return (102 <svg103 viewBox="0 0 24 24"104 width={size}105 height={size}106 style={{ transform: "rotate(-90deg)" }}107 aria-hidden108 >109 <circle110 cx={12}111 cy={12}112 r={9}113 fill="none"114 stroke={color}115 strokeOpacity={0.25}116 strokeWidth={2}117 />118 <circle119 cx={12}120 cy={12}121 r={9}122 fill="none"123 stroke={color}124 strokeWidth={2}125 strokeLinecap="round"126 strokeDasharray={`${Math.max(0.01, value) * 56.55} 60`}127 />128 </svg>129 );130}131132function FileFace({133 file,134 w,135 h,136 idx,137 fontFamily,138}: {139 file: DropFile;140 w: number;141 h: number;142 idx: number;143 fontFamily: string;144}) {145 const m = Math.min(w, h);146 if (file.kind === "image") {147 return (148 <Img149 src={file.src ?? "https://kuchi-media.kalarislabs.com/components/art/art-03.svg"}150 alt=""151 style={{152 position: "absolute",153 inset: 0,154 width: "100%",155 height: "100%",156 objectFit: "cover",157 }}158 />159 );160 }161 if (file.kind === "sketch") {162 const j = (k: string) => (random(`mfd-sk-${idx}-${k}`) - 0.5) * 3;163 const ln = (a: number, b: number, c: number, d: number, k: string) =>164 `M ${a + j(`${k}1`)} ${b + j(`${k}2`)} L ${c + j(`${k}3`)} ${d + j(`${k}4`)}`;165 const paths = [166 ln(10, 12, 90, 13, "a"),167 ln(90, 13, 89, 88, "b"),168 ln(89, 88, 11, 87, "c"),169 ln(11, 87, 10, 12, "d"),170 ln(18, 24, 50, 24, "e"),171 ln(18, 34, 82, 34, "f"),172 ln(82, 34, 82, 62, "g"),173 ln(82, 62, 18, 62, "h"),174 ln(18, 62, 18, 34, "i"),175 ln(18, 34, 82, 62, "k"),176 ln(18, 72, 60, 72, "l"),177 ln(18, 79, 44, 79, "n"),178 ];179 return (180 <div181 style={{182 position: "absolute",183 inset: 0,184 background: "linear-gradient(180deg, #f2f0ea 0%, #e6e3dc 100%)",185 }}186 >187 <svg188 viewBox="0 0 100 100"189 preserveAspectRatio="none"190 style={{191 position: "absolute",192 inset: "6%",193 width: "88%",194 height: "88%",195 }}196 aria-hidden197 >198 {paths.map((d) => (199 <path200 key={d}201 d={d}202 fill="none"203 stroke="#33322e"204 strokeWidth={1.5}205 vectorEffect="non-scaling-stroke"206 strokeLinecap="round"207 />208 ))}209 </svg>210 </div>211 );212 }213 const sheet = file.kind === "sheet";214 const tag = sheet ? "#1f9d63" : "#e5484d";215 const ext = file.name.split(".").pop()?.toUpperCase() ?? "";216 return (217 <div218 style={{219 position: "absolute",220 inset: 0,221 background: "#ffffff",222 fontFamily,223 }}224 >225 <div226 style={{227 position: "absolute",228 left: "11%",229 top: "11%",230 width: m * 0.3,231 height: m * 0.3,232 borderRadius: m * 0.07,233 background: tag,234 display: "flex",235 alignItems: "center",236 justifyContent: "center",237 }}238 >239 <svg viewBox="0 0 24 24" width={m * 0.19} height={m * 0.19} aria-hidden>240 <g241 fill="none"242 stroke="#ffffff"243 strokeWidth={1.8}244 strokeLinecap="round"245 strokeLinejoin="round"246 >247 {sheet ? (248 <path d="M4.5 4.5h15v15h-15zM4.5 9.5h15M4.5 14.5h15M10 9.5v10" />249 ) : (250 <>251 <path d="M6 2.8h7.6L18.5 7.7v13.5H6z" />252 <path d="M13.3 2.8v5.2h5.2M9 13h6M9 16.5h4" />253 </>254 )}255 </g>256 </svg>257 </div>258 <div259 style={{260 position: "absolute",261 left: "11%",262 right: "6%",263 bottom: "9%",264 lineHeight: 1.25,265 whiteSpace: "nowrap",266 overflow: "hidden",267 textOverflow: "ellipsis",268 }}269 >270 <div style={{ fontSize: m * 0.16, color: "#20232c" }}>{file.name}</div>271 <div272 style={{273 fontSize: m * 0.145,274 color: "rgba(32,35,44,0.55)",275 fontVariantNumeric: "tabular-nums",276 }}277 >278 {file.size ? `${ext} · ${file.size}` : ext}279 </div>280 </div>281 </div>282 );283}284285function Cursor({ size }: { size: number }) {286 return (287 <svg288 viewBox="0 0 24 24"289 width={size}290 height={size}291 style={{292 display: "block",293 filter: "drop-shadow(0 3px 5px rgba(0,0,0,0.35))",294 }}295 aria-hidden296 >297 <path298 d="M5 3.2v15.6l4.3-4.1 2.7 6.1 2.6-1.1-2.7-6h6z"299 fill="#0d0f10"300 stroke="#fff"301 strokeWidth={1.4}302 strokeLinejoin="round"303 />304 </svg>305 );306}307308export interface MultiFileDropProps {309 theme?: "dark" | "light";310 accent?: string;311 heading?: string;312 prompt?: string;313 files?: DropFile[];314 resolveOrder?: number[];315 ground?: GshPresetId;316 groundParams?: Partial<GradientParams>;317 /** Label on the attach pill before the files land. */318 attachLabel?: string;319 /** Label of the mode picker next to the send button. */320 modeLabel?: string;321 /** Total size shown once every file has uploaded. */322 totalSize?: string;323 /** Text color; overrides the theme ink. */324 ink?: string;325 /** Solid fill in place of the gradient ground; "transparent" drops it. */326 background?: string;327 /** Typeface for the copy. Load it yourself; Hanken Grotesk by default. */328 fontFamily?: string;329 /** Size of the heading, card and files, around the frame's center. */330 scale?: number;331 /** Frames to hold the first frame before anything moves. */332 delay?: number;333 speed?: number;334}335336/** The foreground at `scale`, around the frame's center; nothing extra at 1. */337function ScaleLayer({338 scale,339 children,340}: {341 scale: number;342 children: React.ReactNode;343}) {344 if (scale === 1) return children;345 return (346 <AbsoluteFill style={{ transform: `scale(${scale})` }}>347 {children}348 </AbsoluteFill>349 );350}351352export function MultiFileDrop({353 theme = "dark",354 accent = "#3B5BFD",355 heading = "What are we launching?",356 prompt = "Build a launch page for v2 with a hero video, a pricing table and a waitlist.",357 files = DEFAULT_FILES,358 resolveOrder = [0, 2, 1, 3],359 ground,360 groundParams,361 attachLabel = "Attach",362 modeLabel = "Build",363 totalSize = "3.4 MB",364 ink: inkProp,365 background,366 fontFamily = hanken.fontFamily,367 scale = 1,368 delay = 0,369 speed = 1,370}: MultiFileDropProps) {371 const frame = Math.max(0, useCurrentFrame() - delay) * speed;372 const { width, height, fps } = useVideoConfig();373 const dark = theme === "dark";374 const portrait = height > width * 1.2;375 const stageW = portrait ? 1080 : 1280;376 const stageH = portrait ? 1920 : 720;377 const sc = width / stageW;378 const u = portrait ? 2 : 1.1;379380 const ink = inkProp ?? (dark ? "#eef0fa" : "#141722");381 const soft = dark ? "rgba(226,230,248,0.72)" : "rgba(20,23,34,0.7)";382 const muted = dark ? "rgba(226,230,248,0.46)" : "rgba(20,23,34,0.46)";383 const hair = dark ? "rgba(255,255,255,0.1)" : "rgba(20,24,48,0.1)";384 const slotBg = dark ? "rgba(255,255,255,0.05)" : "#f1f2f6";385 const surface = dark386 ? "linear-gradient(180deg, rgba(25,28,40,0.9) 0%, rgba(13,15,24,0.94) 100%)"387 : "linear-gradient(180deg, #ffffff 0%, #fafbfd 100%)";388 const ring = dark ? "rgba(255,255,255,0.09)" : "rgba(20,24,48,0.07)";389 const shadow = dark390 ? "inset 0 1px 0 rgba(255,255,255,0.05), 0 30px 70px rgba(2,4,24,0.55)"391 : "0 1px 2px rgba(40,40,110,0.06), 0 24px 60px rgba(40,40,110,0.14)";392393 const n = Math.min(4, files.length);394 const list = files.slice(0, n);395 const order = resolveOrder.filter((k) => k < n);396 const resolveAt = (i: number) => {397 const k = order.indexOf(i);398 return B.resolve[k >= 0 ? k : i] ?? B.resolve[B.resolve.length - 1];399 };400401 const pad = 22 * u;402 const fontSize = 24 * u;403 const lh = fontSize * 1.42;404 const textH = lh * 2;405 const footH = 40 * u;406 const slot = 100 * u;407 const slotGap = 12 * u;408 const cardW = portrait ? 960 : 900;409 const cardX = (stageW - cardW) / 2;410 const headSize = portrait ? 84 : 48;411 const headH = headSize * 1.2;412 const headGap = portrait ? 64 : 30;413414 const grow = spring({415 frame: frame - B.deal,416 fps,417 config: MORPH,418 durationInFrames: 16,419 });420 const baseH = pad + textH + 18 * u + footH + pad;421 const cardH = baseH + grow * (slot + 16 * u);422 const groupH = headH + headGap + baseH + slot + 16 * u;423 const groupTop = (stageH - groupH) / 2 + (portrait ? 150 : 14);424 const cardTop =425 groupTop + headH + headGap + (1 - grow) * (slot + 16 * u) * 0.5;426427 const headIn = ramp(frame, B.head, 15);428 const cardIn = spring({ frame: frame - B.card, fps, config: HEAVY });429430 const fanW = 168 * u;431 const fanH = 128 * u;432 const hoverX = portrait ? cardX + cardW * 0.56 : cardX + cardW - fanW * 0.85;433 const hoverY = cardTop + (portrait ? baseH + fanH * 0.12 : baseH * 0.08);434 const startX = stageW + fanW * 0.9;435 const startY = portrait ? stageH + fanH * 0.4 : -fanH * 0.6;436 const ctrlX = mix(startX, hoverX, 0.35);437 const ctrlY = portrait ? hoverY + 240 : hoverY - 120;438 const bez = (t: number, a: number, c: number, b: number) =>439 (1 - t) * (1 - t) * a + 2 * (1 - t) * t * c + t * t * b;440 const flyAt = (f: number) =>441 spring({ frame: f - B.fly, fps, config: CARD, durationInFrames: 24 });442 const fp = flyAt(frame);443 const fpPrev = flyAt(frame - 1);444 const hoverAmt = ramp(frame, B.hover - 4, 10) * (1 - ramp(frame, B.drop, 4));445 const fanCx =446 bez(fp, startX, ctrlX, hoverX) +447 Math.sin((frame - B.hover) / 7) * 4 * u * hoverAmt;448 const fanCy =449 bez(fp, startY, ctrlY, hoverY) +450 Math.cos((frame - B.hover) / 9) * 4 * u * hoverAmt +451 10 * u * ramp(frame, B.drop - 3, 4, EXIT);452 const fanSpeed = Math.hypot(453 fanCx - bez(fpPrev, startX, ctrlX, hoverX),454 fanCy - bez(fpPrev, startY, ctrlY, hoverY),455 );456 const fanSpread =457 mix(0.35, 1, ramp(frame, B.fly + 6, 18)) *458 (1 - 0.25 * ramp(frame, B.drop - 3, 4, EXIT));459 const fanTilt = mix(14, 0, fp);460 const dropZone =461 ramp(frame, B.hover - 8, 10) * (1 - ramp(frame, B.deal, 8, EXIT));462463 const slotX = (i: number) => cardX + pad + i * (slot + slotGap) + slot / 2;464 const slotY = cardTop + pad + slot / 2;465466 const curDX = fanW * 0.42;467 const curDY = fanH * 0.38;468 const sendX = cardX + cardW - pad - 19 * u;469 const sendY = cardTop + cardH - pad - footH / 2;470 const curGo = spring({471 frame: frame - B.cursorOut,472 fps,473 config: HEAVY,474 durationInFrames: 36,475 });476 const curLeave = spring({ frame: frame - B.leave, fps, config: HEAVY });477 const curX = mix(fanCx + curDX, sendX + 6 * u, curGo) + curLeave * 70 * u;478 const curY =479 mix(fanCy + curDY, sendY + 8 * u, curGo) +480 curLeave * 46 * u -481 Math.sin(Math.PI * Math.min(1, curLeave)) * 10 * u;482 const sendPress = Math.max(483 0,484 spring({ frame: frame - B.send + 2, fps, config: CHIP }) -485 spring({ frame: frame - B.send - 2, fps, config: CHIP }),486 );487 const sent = ramp(frame, B.send + 1, 8);488 const badge =489 spring({ frame: frame - B.fly - 8, fps, config: CHIP }) *490 (1 - ramp(frame, B.drop - 2, 5, EXIT));491 const curPress =492 Math.max(493 0,494 spring({ frame: frame - B.drop + 3, fps, config: CHIP }) -495 spring({ frame: frame - B.drop - 1, fps, config: CHIP }),496 ) + sendPress;497498 const resolvedCount = list.filter((_, i) => frame >= resolveAt(i) + 2).length;499 const ready = ramp(frame, B.ready, 8);500 const readyPop = spring({ frame: frame - B.ready, fps, config: CHIP });501 const push = 1 + 0.035 * ramp(frame, B.deal, B.end - B.deal, SWAY);502 const settle = spring({ frame: frame + 6, fps, config: HEAVY });503 const rotX = mix(14, 3, settle) - 2 * ramp(frame, B.deal, 40, MOVE);504505 const resolvedGround: GshPresetId =506 ground ?? (dark ? "cobalt-rise" : "paper-crease");507 const resolvedParams = groundParams;508509 return (510 <AbsoluteFill style={{ fontFamily, overflow: "hidden" }}>511 {background === undefined ? (512 <GshGround513 preset={resolvedGround}514 params={resolvedParams}515 timeOffset={3}516 timeScale={0.5}517 style={portrait ? { transform: "scaleY(-1)" } : undefined}518 />519 ) : (520 <AbsoluteFill521 style={{522 background: background === "transparent" ? undefined : background,523 }}524 />525 )}526 <ScaleLayer scale={scale}>527 <div528 style={{529 position: "absolute",530 left: 0,531 top: 0,532 width: stageW,533 height: stageH,534 transform: `scale(${sc})`,535 transformOrigin: "0 0",536 perspective: 2200,537 }}538 >539 <div540 style={{541 position: "absolute",542 inset: 0,543 transformStyle: "preserve-3d",544 transformOrigin: `${stageW / 2}px ${cardTop + cardH / 2}px`,545 transform: `scale(${push}) rotateX(${rotX}deg)`,546 }}547 >548 <div549 style={{550 position: "absolute",551 left: 0,552 right: 0,553 top: groupTop,554 height: headH,555 overflow: "hidden",556 textAlign: "center",557 }}558 >559 <div560 style={{561 fontSize: headSize,562 lineHeight: 1.2,563 fontWeight: 300,564 letterSpacing: "-0.035em",565 color: ink,566 transform: `translateY(${mix(100, 0, headIn)}%)`,567 }}568 >569 {heading}570 </div>571 </div>572573 <div574 style={{575 position: "absolute",576 left: cardX,577 top: cardTop,578 width: cardW,579 height: cardH,580 borderRadius: 20 * u,581 background: surface,582 boxShadow: `0 0 0 1px ${dropZone > 0 ? `color-mix(in oklab, ${accent} ${Math.round(dropZone * 85)}%, ${ring})` : ring}, 0 0 0 ${4 * u * dropZone}px color-mix(in oklab, ${accent} ${Math.round(dropZone * 20)}%, transparent), ${shadow}`,583 opacity: cardIn,584 transform: `translateY(${mix(40 * u, 0, cardIn)}px)`,585 }}586 >587 <div588 style={{589 position: "absolute",590 inset: 0,591 borderRadius: 20 * u,592 background: `color-mix(in oklab, ${accent} ${Math.round(dropZone * (dark ? 14 : 8))}%, transparent)`,593 }}594 />595 {list.map((f, i) => (596 <div597 key={f.name}598 style={{599 position: "absolute",600 left: pad + i * (slot + slotGap),601 top: pad,602 width: slot,603 height: slot,604 borderRadius: 12 * u,605 background: slotBg,606 border: `1px dashed ${hair}`,607 opacity:608 grow * (1 - ramp(frame, B.deal + i * B.dealStep + 6, 4)),609 }}610 />611 ))}612 <div613 style={{614 position: "absolute",615 left: pad,616 right: pad,617 top: pad + grow * (slot + 16 * u),618 height: textH,619 fontSize,620 lineHeight: `${lh}px`,621 color: ink,622 overflow: "hidden",623 }}624 >625 {prompt}626 </div>627 <div628 style={{629 position: "absolute",630 left: pad,631 right: pad,632 bottom: pad,633 height: footH,634 display: "flex",635 alignItems: "center",636 gap: 10 * u,637 fontSize: 17 * u,638 color: soft,639 }}640 >641 <div642 style={{643 height: footH,644 padding: `0 ${14 * u}px`,645 borderRadius: 99,646 border: `1px solid ${hair}`,647 display: "flex",648 alignItems: "center",649 gap: 8 * u,650 }}651 >652 <svg653 viewBox="0 0 24 24"654 width={18 * u}655 height={18 * u}656 aria-hidden657 >658 <path659 d="M16.5 7.5 9.4 14.6a1.8 1.8 0 0 0 2.6 2.6l7.4-7.4a3.6 3.6 0 0 0-5.1-5.1l-7.6 7.6a5.4 5.4 0 0 0 7.6 7.6l5.2-5.2"660 fill="none"661 stroke={soft}662 strokeWidth={1.5}663 strokeLinecap="round"664 strokeLinejoin="round"665 />666 </svg>667 <span style={{ fontVariantNumeric: "tabular-nums" }}>668 {frame < B.deal669 ? attachLabel670 : resolvedCount < n671 ? `Uploading ${resolvedCount}/${n}`672 : `${n} files · ${totalSize}`}673 </span>674 </div>675 <div style={{ marginLeft: "auto" }}>{modeLabel}</div>676 <svg677 viewBox="0 0 24 24"678 width={16 * u}679 height={16 * u}680 aria-hidden681 >682 <path683 d="m7 10 5 5 5-5"684 fill="none"685 stroke={soft}686 strokeWidth={1.5}687 strokeLinecap="round"688 strokeLinejoin="round"689 />690 </svg>691 <svg692 viewBox="0 0 24 24"693 width={20 * u}694 height={20 * u}695 aria-hidden696 style={{ marginLeft: 6 * u }}697 >698 <g699 fill="none"700 stroke={soft}701 strokeWidth={1.5}702 strokeLinecap="round"703 >704 <rect x={9} y={3.5} width={6} height={11} rx={3} />705 <path d="M6 11.5a6 6 0 0 0 12 0M12 17.5v3" />706 </g>707 </svg>708 <div709 style={{710 width: 38 * u,711 height: 38 * u,712 borderRadius: 11 * u,713 marginLeft: 4 * u,714 background:715 ready > 0716 ? accent717 : dark718 ? "rgba(255,255,255,0.1)"719 : "rgba(20,24,48,0.08)",720 transform: `scale(${(1 + 0.06 * Math.sin(Math.PI * Math.min(1, readyPop)) * ready) * (1 - 0.04 * sendPress)})`,721 boxShadow:722 ready > 0723 ? "inset 0 1px 0 rgba(255,255,255,0.22), 0 1px 2px rgba(4,6,30,0.3)"724 : undefined,725 display: "flex",726 alignItems: "center",727 justifyContent: "center",728 }}729 >730 <svg731 viewBox="0 0 24 24"732 width={18 * u}733 height={18 * u}734 aria-hidden735 >736 <path737 d="M12 19V5M6 11l6-6 6 6"738 fill="none"739 stroke={ready > 0 ? "#fff" : muted}740 strokeWidth={2}741 strokeLinecap="round"742 strokeLinejoin="round"743 opacity={1 - sent}744 transform={`translate(0 ${-4 * sent})`}745 />746 <rect747 x={7.5}748 y={7.5}749 width={9}750 height={9}751 rx={2}752 fill="#fff"753 opacity={sent}754 transform={`translate(12 12) scale(${mix(0.4, 1, sent)}) translate(-12 -12)`}755 />756 </svg>757 </div>758 </div>759 </div>760761 {list.map((f, i) => {762 const k = n - 1 - i;763 const fan = FAN[i] ?? FAN[0];764 const dealT = B.deal + k * B.dealStep;765 const go = spring({ frame: frame - dealT, fps, config: CARD });766 const goPrev = spring({767 frame: frame - dealT - 1,768 fps,769 config: CARD,770 });771 const fx = fanCx + fan.x * u * fanSpread;772 const fy = fanCy + fan.y * u * fanSpread;773 const x = mix(fx, slotX(i), go);774 const y = mix(fy, slotY, go);775 const px = mix(fx, slotX(i), goPrev);776 const py = mix(fy, slotY, goPrev);777 const vel = frame > dealT ? Math.hypot(x - px, y - py) : fanSpeed;778 const w = mix(fanW, slot, go);779 const h = mix(fanH, slot, go);780 const r = mix(fan.r * fanSpread + fanTilt, 0, go);781 const landed = ramp(frame, dealT + B.land - 4, 6);782 const rs = resolveAt(i);783 const done = ramp(frame, rs, 6);784 const pop = spring({ frame: frame - rs, fps, config: CHIP });785 const punch =786 1 + 0.07 * Math.sin(Math.PI * Math.min(1, pop)) * done;787 const loading = landed * (1 - done);788 const progress = interpolate(789 frame,790 [dealT + B.land - 4, rs],791 [0.06, 1],792 {793 extrapolateLeft: "clamp",794 extrapolateRight: "clamp",795 easing: MOVE,796 },797 );798 const lift = 1 - go;799 return (800 <div801 key={f.name}802 style={{803 position: "absolute",804 left: x - w / 2,805 top: y - h / 2,806 width: w,807 height: h,808 transform: `rotate(${r}deg) scale(${punch})`,809 borderRadius: mix(14, 12, go) * u,810 overflow: "hidden",811 outline: `1px solid ${dark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)"}`,812 outlineOffset: -1,813 background: slotBg,814 boxShadow: `0 ${mix(2, 22, lift) * u}px ${mix(6, 40, lift) * u}px rgba(4,6,30,${dark ? 0.5 : 0.2})`,815 opacity: ramp(frame, B.fly, 4),816 filter:817 vel > 8818 ? `blur(${Math.min(5, vel * 0.05)}px)`819 : undefined,820 zIndex: 10 + i,821 }}822 >823 <div824 style={{825 position: "absolute",826 inset: 0,827 opacity: 1 - 0.78 * loading,828 filter:829 loading > 0.01830 ? `blur(${loading * 6}px) saturate(${1 - loading * 0.6})`831 : undefined,832 transform: `scale(${1 + 0.08 * loading})`,833 }}834 >835 <FileFace836 file={f}837 w={w}838 h={h}839 idx={i}840 fontFamily={fontFamily}841 />842 </div>843 <div844 style={{845 position: "absolute",846 inset: 0,847 display: "flex",848 alignItems: "center",849 justifyContent: "center",850 opacity: loading,851 }}852 >853 <Progress854 size={30 * u}855 color={dark ? "#ffffff" : "#1a1f33"}856 value={progress}857 />858 </div>859 </div>860 );861 })}862863 <div864 style={{865 position: "absolute",866 left: curX,867 top: curY,868 transform: `scale(${1 - 0.04 * curPress})`,869 transformOrigin: "4px 3px",870 opacity: ramp(frame, B.fly + 2, 6),871 zIndex: 30,872 }}873 >874 <Cursor size={30 * u} />875 <div876 style={{877 position: "absolute",878 left: 20 * u,879 top: 22 * u,880 minWidth: 26 * u,881 height: 26 * u,882 padding: `0 ${7 * u}px`,883 borderRadius: 99,884 background: accent,885 border: `${1.5 * u}px solid ${dark ? "#0d0f18" : "#ffffff"}`,886 color: "#fff",887 fontFamily: mono.fontFamily,888 fontSize: 16 * u,889 lineHeight: 1,890 display: "flex",891 alignItems: "center",892 justifyContent: "center",893 boxShadow: "0 4px 10px rgba(4,6,30,0.35)",894 transform: `scale(${badge})`,895 }}896 >897 {n}898 </div>899 </div>900 </div>901 </div>902 </ScaleLayer>903 </AbsoluteFill>904 );905}906907export default MultiFileDrop;









