agentcut 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +11 -2
- package/dist/bridge.d.ts +45 -0
- package/dist/bridge.js +691 -0
- package/dist/bridge.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +50 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/log.d.ts +1 -0
- package/dist/log.js +14 -0
- package/dist/log.js.map +1 -0
- package/dist/studio/agents/claude.d.ts +7 -0
- package/dist/studio/agents/claude.js +155 -0
- package/dist/studio/agents/claude.js.map +1 -0
- package/dist/studio/agents/codex.d.ts +4 -0
- package/dist/studio/agents/codex.js +169 -0
- package/dist/studio/agents/codex.js.map +1 -0
- package/dist/studio/agents/index.d.ts +8 -0
- package/dist/studio/agents/index.js +50 -0
- package/dist/studio/agents/index.js.map +1 -0
- package/dist/studio/agents/types.d.ts +131 -0
- package/dist/studio/agents/types.js +11 -0
- package/dist/studio/agents/types.js.map +1 -0
- package/dist/studio/bundler.d.ts +29 -0
- package/dist/studio/bundler.js +136 -0
- package/dist/studio/bundler.js.map +1 -0
- package/dist/studio/chat.d.ts +147 -0
- package/dist/studio/chat.js +681 -0
- package/dist/studio/chat.js.map +1 -0
- package/dist/studio/cli.d.ts +2 -0
- package/dist/studio/cli.js +194 -0
- package/dist/studio/cli.js.map +1 -0
- package/dist/studio/components.d.ts +4 -0
- package/dist/studio/components.js +36 -0
- package/dist/studio/components.js.map +1 -0
- package/dist/studio/host.d.ts +105 -0
- package/dist/studio/host.js +634 -0
- package/dist/studio/host.js.map +1 -0
- package/dist/studio/http.d.ts +21 -0
- package/dist/studio/http.js +240 -0
- package/dist/studio/http.js.map +1 -0
- package/dist/studio/music.d.ts +35 -0
- package/dist/studio/music.js +130 -0
- package/dist/studio/music.js.map +1 -0
- package/dist/studio/proc.d.ts +11 -0
- package/dist/studio/proc.js +69 -0
- package/dist/studio/proc.js.map +1 -0
- package/dist/studio/projects.d.ts +84 -0
- package/dist/studio/projects.js +369 -0
- package/dist/studio/projects.js.map +1 -0
- package/dist/studio/render.d.ts +24 -0
- package/dist/studio/render.js +197 -0
- package/dist/studio/render.js.map +1 -0
- package/dist/studio/reveal.d.ts +7 -0
- package/dist/studio/reveal.js +49 -0
- package/dist/studio/reveal.js.map +1 -0
- package/dist/studio/schema.d.ts +4152 -0
- package/dist/studio/schema.js +358 -0
- package/dist/studio/schema.js.map +1 -0
- package/dist/studio/tools.d.ts +2 -0
- package/dist/studio/tools.js +165 -0
- package/dist/studio/tools.js.map +1 -0
- package/dist/studio/voice.d.ts +150 -0
- package/dist/studio/voice.js +434 -0
- package/dist/studio/voice.js.map +1 -0
- package/dist/studio/workspace.d.ts +31 -0
- package/dist/studio/workspace.js +187 -0
- package/dist/studio/workspace.js.map +1 -0
- package/package.json +50 -4
- package/template/AGENTS.md +13 -0
- package/template/components/CATALOG.md +1306 -0
- package/template/components/README.md +61 -0
- package/template/components/STYLES.md +246 -0
- package/template/components/arcade-title/ArcadeTitle.tsx +860 -0
- package/template/components/arcade-title/meta.json +28 -0
- package/template/components/aurora/Aurora.tsx +63 -0
- package/template/components/aurora/meta.json +28 -0
- package/template/components/bar-wipe-title/BarWipeTitle.tsx +94 -0
- package/template/components/bar-wipe-title/meta.json +29 -0
- package/template/components/before-after/BeforeAfter.tsx +89 -0
- package/template/components/before-after/meta.json +233 -0
- package/template/components/bento-grid/BentoGrid.tsx +202 -0
- package/template/components/bento-grid/meta.json +25 -0
- package/template/components/blur-in-title/BlurInTitle.tsx +121 -0
- package/template/components/blur-in-title/meta.json +32 -0
- package/template/components/catalog.json +8730 -0
- package/template/components/catalog.ts +103 -0
- package/template/components/chat-thread/ChatThread.tsx +128 -0
- package/template/components/chat-thread/meta.json +24 -0
- package/template/components/checklist/Checklist.tsx +129 -0
- package/template/components/checklist/meta.json +25 -0
- package/template/components/confetti/Confetti.tsx +109 -0
- package/template/components/confetti/meta.json +28 -0
- package/template/components/countdown/Countdown.tsx +166 -0
- package/template/components/countdown/meta.json +28 -0
- package/template/components/cut-and-paste/CutAndPaste.tsx +654 -0
- package/template/components/cut-and-paste/meta.json +29 -0
- package/template/components/decode-text/DecodeText.tsx +97 -0
- package/template/components/decode-text/meta.json +29 -0
- package/template/components/editorial-quote/EditorialQuote.tsx +122 -0
- package/template/components/editorial-quote/meta.json +28 -0
- package/template/components/glitch-title/GlitchTitle.tsx +171 -0
- package/template/components/glitch-title/meta.json +32 -0
- package/template/components/halftone-wave/HalftoneWave.tsx +106 -0
- package/template/components/halftone-wave/meta.json +28 -0
- package/template/components/highlighter/Highlighter.tsx +142 -0
- package/template/components/highlighter/meta.json +28 -0
- package/template/components/hook-card/HookCard.tsx +552 -0
- package/template/components/hook-card/meta.json +304 -0
- package/template/components/index.ts +149 -0
- package/template/components/iris-wipe/IrisWipe.tsx +76 -0
- package/template/components/iris-wipe/meta.json +24 -0
- package/template/components/kinetic-poster/KineticPoster.tsx +437 -0
- package/template/components/kinetic-poster/meta.json +31 -0
- package/template/components/kinetic-punch/KineticPunch.tsx +80 -0
- package/template/components/kinetic-punch/meta.json +30 -0
- package/template/components/lava-lamp/LavaLamp.tsx +92 -0
- package/template/components/lava-lamp/meta.json +28 -0
- package/template/components/letter-cascade/LetterCascade.tsx +102 -0
- package/template/components/letter-cascade/meta.json +29 -0
- package/template/components/lib.ts +179 -0
- package/template/components/light-leak/LightLeakTransition.tsx +43 -0
- package/template/components/light-leak/meta.json +74 -0
- package/template/components/line-diagram/LineDiagram.tsx +205 -0
- package/template/components/line-diagram/meta.json +217 -0
- package/template/components/list-card/ListCard.tsx +104 -0
- package/template/components/list-card/meta.json +232 -0
- package/template/components/logo-sting/LogoSting.tsx +129 -0
- package/template/components/logo-sting/meta.json +29 -0
- package/template/components/looks.tsx +1447 -0
- package/template/components/lower-third/LowerThird.tsx +100 -0
- package/template/components/lower-third/meta.json +24 -0
- package/template/components/marquee/Marquee.tsx +100 -0
- package/template/components/marquee/meta.json +30 -0
- package/template/components/notification/Notification.tsx +115 -0
- package/template/components/notification/meta.json +27 -0
- package/template/components/outline-fill/OutlineFill.tsx +106 -0
- package/template/components/outline-fill/meta.json +28 -0
- package/template/components/panel-sweep/PanelSweep.tsx +86 -0
- package/template/components/panel-sweep/meta.json +25 -0
- package/template/components/prompt-box/PromptBox.tsx +131 -0
- package/template/components/prompt-box/meta.json +24 -0
- package/template/components/props.ts +73 -0
- package/template/components/quote-card/QuoteCard.tsx +71 -0
- package/template/components/quote-card/meta.json +216 -0
- package/template/components/shape-shift/ShapeShift.tsx +420 -0
- package/template/components/shape-shift/meta.json +31 -0
- package/template/components/slide-zoom-message/SlideZoomMessage.tsx +179 -0
- package/template/components/slide-zoom-message/meta.json +199 -0
- package/template/components/social-post/SocialPost.tsx +185 -0
- package/template/components/social-post/meta.json +30 -0
- package/template/components/split-flap/SplitFlap.tsx +191 -0
- package/template/components/split-flap/meta.json +29 -0
- package/template/components/spotlight-grid/SpotlightGrid.tsx +84 -0
- package/template/components/spotlight-grid/meta.json +25 -0
- package/template/components/stat-counter/StatCounter.tsx +117 -0
- package/template/components/stat-counter/meta.json +27 -0
- package/template/components/sticker-badge/StickerBadge.tsx +46 -0
- package/template/components/sticker-badge/meta.json +220 -0
- package/template/components/sticker-slam/StickerSlam.tsx +941 -0
- package/template/components/sticker-slam/meta.json +34 -0
- package/template/components/style-layer.tsx +233 -0
- package/template/components/styles.json +762 -0
- package/template/components/styles.ts +113 -0
- package/template/components/target-lock/TargetLock.tsx +662 -0
- package/template/components/target-lock/meta.json +32 -0
- package/template/components/text-reveal/TextReveal.tsx +99 -0
- package/template/components/text-reveal/meta.json +28 -0
- package/template/components/tile-wipe/TileWipe.tsx +75 -0
- package/template/components/tile-wipe/meta.json +24 -0
- package/template/components/type-zoom/TypeZoom.tsx +103 -0
- package/template/components/type-zoom/meta.json +27 -0
- package/template/components/types.ts +66 -0
- package/template/components/typewriter/Typewriter.tsx +112 -0
- package/template/components/typewriter/meta.json +29 -0
- package/template/components/word-pop/WordPop.tsx +59 -0
- package/template/components/word-pop/meta.json +237 -0
- package/template/components/word-stack/WordStack.tsx +122 -0
- package/template/components/word-stack/meta.json +27 -0
- package/template/components/word-swap/WordSwap.tsx +127 -0
- package/template/components/word-swap/meta.json +30 -0
- package/template/presets/charcoal-sketch/PROMPT.md +48 -0
- package/template/presets/charcoal-sketch/assets/paper/grain-0.png +0 -0
- package/template/presets/charcoal-sketch/assets/paper/grain-1.png +0 -0
- package/template/presets/charcoal-sketch/assets/paper/grain-2.png +0 -0
- package/template/presets/charcoal-sketch/assets/paper/sketch-paper.jpg +0 -0
- package/template/presets/charcoal-sketch/assets/paper/smudge.png +0 -0
- package/template/presets/charcoal-sketch/poster.jpg +0 -0
- package/template/presets/charcoal-sketch/preset.json +17 -0
- package/template/presets/charcoal-sketch/preview.mp4 +0 -0
- package/template/presets/charcoal-sketch/scenes/Grain.tsx +23 -0
- package/template/presets/charcoal-sketch/scenes/Paper.tsx +17 -0
- package/template/presets/charcoal-sketch/scenes/examples/Agents.tsx +100 -0
- package/template/presets/charcoal-sketch/scenes/examples/Approvals.tsx +110 -0
- package/template/presets/charcoal-sketch/scenes/examples/Blog.tsx +105 -0
- package/template/presets/charcoal-sketch/scenes/examples/EndCard.tsx +41 -0
- package/template/presets/charcoal-sketch/scenes/examples/Hook.tsx +130 -0
- package/template/presets/charcoal-sketch/scenes/examples/Ideas.tsx +92 -0
- package/template/presets/charcoal-sketch/scenes/examples/Posting.tsx +128 -0
- package/template/presets/charcoal-sketch/scenes/lib/painfix.tsx +119 -0
- package/template/presets/charcoal-sketch/scenes/lib/sketch.tsx +291 -0
- package/template/presets/charcoal-sketch/scripts/build_layers.example.py +193 -0
- package/template/presets/charcoal-sketch/scripts/duck_music.py +34 -0
- package/template/presets/charcoal-sketch/scripts/make_textures.py +93 -0
- package/template/presets/punk-cut-paper/PROMPT.md +37 -0
- package/template/presets/punk-cut-paper/assets/paper/desk-cream.jpg +0 -0
- package/template/presets/punk-cut-paper/assets/paper/grain-overlay.png +0 -0
- package/template/presets/punk-cut-paper/assets/paper/halftone-black.png +0 -0
- package/template/presets/punk-cut-paper/assets/paper/halftone-red.png +0 -0
- package/template/presets/punk-cut-paper/assets/paper/halftone-yellow.png +0 -0
- package/template/presets/punk-cut-paper/assets/paper/kraft.jpg +0 -0
- package/template/presets/punk-cut-paper/assets/paper/newsprint.jpg +0 -0
- package/template/presets/punk-cut-paper/assets/paper/paper-cream.jpg +0 -0
- package/template/presets/punk-cut-paper/assets/paper/paper-white.jpg +0 -0
- package/template/presets/punk-cut-paper/assets/paper/tape.png +0 -0
- package/template/presets/punk-cut-paper/build_layers.example.py +150 -0
- package/template/presets/punk-cut-paper/poster.jpg +0 -0
- package/template/presets/punk-cut-paper/preset.json +15 -0
- package/template/presets/punk-cut-paper/preview.mp4 +0 -0
- package/template/presets/punk-cut-paper/scenes/Backdrop.tsx +76 -0
- package/template/presets/punk-cut-paper/scenes/Motif.tsx +376 -0
- package/template/presets/punk-cut-paper/scenes/Photo.tsx +73 -0
- package/template/presets/punk-cut-paper/scenes/Ransom.tsx +119 -0
- package/template/presets/punk-cut-paper/scenes/Xerox.tsx +31 -0
- package/template/presets/punk-cut-paper/scenes/lib/punk.tsx +208 -0
- package/template/runtime/composition.tsx +920 -0
- package/template/runtime/helpers.tsx +228 -0
- package/template/runtime/index.tsx +22 -0
- package/template/runtime/types.ts +248 -0
- package/template/skill/SKILL.md +149 -0
- package/template/skill/references/browser-export.md +61 -0
- package/template/skill/references/components.md +38 -0
- package/template/skill/references/craft.md +53 -0
- package/template/skill/references/cursor.md +91 -0
- package/template/skill/references/footage.md +73 -0
- package/template/skill/references/format.md +140 -0
- package/template/skill/references/presets.md +56 -0
- package/template/skill/references/sound.md +128 -0
- package/template/starter/.studio/chat.json +1 -0
- package/template/starter/assets/.keep +0 -0
- package/template/starter/layers.json +46 -0
- package/template/starter/notes.md +4 -0
- package/template/starter/project.json +13 -0
- package/template/starter/renders/.keep +0 -0
- package/template/starter/scenes/Title.tsx +38 -0
|
@@ -0,0 +1,941 @@
|
|
|
1
|
+
import { useId, type ReactNode } from "react";
|
|
2
|
+
import { AbsoluteFill, Img, random, spring, useCurrentFrame } from "remotion";
|
|
3
|
+
import { FONTS, blurStyle, clamp01, exitOut, mix, ramp, unit } from "../lib";
|
|
4
|
+
import type { MotionBaseProps } from "../types";
|
|
5
|
+
|
|
6
|
+
type Props = MotionBaseProps & {
|
|
7
|
+
name: string;
|
|
8
|
+
tagline: string;
|
|
9
|
+
mark: string;
|
|
10
|
+
shape: string;
|
|
11
|
+
color: string;
|
|
12
|
+
textColor: string;
|
|
13
|
+
border: string;
|
|
14
|
+
font: string;
|
|
15
|
+
weight: string;
|
|
16
|
+
size: number;
|
|
17
|
+
cutEvery: number;
|
|
18
|
+
tilt: number;
|
|
19
|
+
peel: boolean;
|
|
20
|
+
flash: boolean;
|
|
21
|
+
images: string[];
|
|
22
|
+
seed: number;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A brand sticker slapped on everything: the background hard-cuts between surfaces (a laptop lid,
|
|
27
|
+
* a brick wall, a skate deck, a street sign, a cardboard box…) or your own images, and on every cut
|
|
28
|
+
* the die-cut sticker in the middle snaps to a new tilt, as if it were stuck there too.
|
|
29
|
+
*/
|
|
30
|
+
export function StickerSlam(props: Props) {
|
|
31
|
+
const frame = useCurrentFrame();
|
|
32
|
+
const { width, height, fps, durationInFrames: d } = props;
|
|
33
|
+
const u = unit(width, height);
|
|
34
|
+
const vertical = height > width;
|
|
35
|
+
const id = `stk${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
36
|
+
const out = exitOut(frame, d, 10);
|
|
37
|
+
|
|
38
|
+
// Cuts: a new surface every `cutEvery` frames, never the same one twice in a row.
|
|
39
|
+
const every = Math.max(2, Math.round(props.cutEvery));
|
|
40
|
+
const cut = Math.floor(frame / every);
|
|
41
|
+
const local = frame - cut * every;
|
|
42
|
+
const images = props.images.map((s) => s.trim()).filter(Boolean);
|
|
43
|
+
const count = images.length || SURFACES.length;
|
|
44
|
+
const index = sequence(cut, count, props.seed);
|
|
45
|
+
const rc = (k: string) => random(`${props.seed}-${cut}-${k}`);
|
|
46
|
+
|
|
47
|
+
// The sticker's size: fit the wordmark inside the frame whatever its length and font.
|
|
48
|
+
const textCut = props.shape === "text-cut";
|
|
49
|
+
const circle = props.shape === "circle";
|
|
50
|
+
const hasMark = props.mark !== "none";
|
|
51
|
+
const charW = CHAR_WIDTH[props.font] ?? 0.58;
|
|
52
|
+
const len = Math.max(1, props.name.length);
|
|
53
|
+
const widthPer = len * charW + (hasMark ? 0.95 : 0) + (textCut ? 0.4 : 1.45);
|
|
54
|
+
const room = circle ? Math.min(width, height) * 0.72 : width * (vertical ? 0.84 : 0.74);
|
|
55
|
+
const wanted = (props.size / 100) * Math.min(width, height) * (vertical ? 1.15 : 1);
|
|
56
|
+
const fontSize = Math.min(wanted, room / widthPer);
|
|
57
|
+
const bw = fontSize * 0.17;
|
|
58
|
+
const padY = fontSize * 0.3;
|
|
59
|
+
const padX = fontSize * 0.55;
|
|
60
|
+
const boxW = fontSize * widthPer;
|
|
61
|
+
const boxH = fontSize * 1.05 + padY * 2 + bw * 2;
|
|
62
|
+
const diameter = Math.max(boxW, boxH * 1.9);
|
|
63
|
+
|
|
64
|
+
// The slap: big and lifted, then pressed flat. Every later cut re-sticks it with a small bump.
|
|
65
|
+
const slap = spring({ frame, fps, config: { damping: 13, stiffness: 420, mass: 0.7 } });
|
|
66
|
+
const lift = 1 - clamp01(slap);
|
|
67
|
+
const side = cut % 2 === 0 ? -1 : 1;
|
|
68
|
+
const angle = side * props.tilt * (0.3 + 0.7 * rc("a")) + lift * side * 10;
|
|
69
|
+
const bump = cut > 0 ? 1 + 0.05 * (1 - ramp(local, 0, 3)) : 1;
|
|
70
|
+
const scale = mix(1.55, 1, slap) * (0.93 + 0.12 * rc("s")) * bump;
|
|
71
|
+
const skew = (rc("k") - 0.5) * 6;
|
|
72
|
+
const jx = (rc("x") - 0.5) * 0.05 * Math.min(width, height);
|
|
73
|
+
const jy = (rc("y") - 0.5) * 0.04 * Math.min(width, height);
|
|
74
|
+
const shadowOff = (6 + 46 * lift) * u;
|
|
75
|
+
const shadowBlur = (7 + 34 * lift) * u;
|
|
76
|
+
const shadowAlpha = 0.5 - 0.22 * lift;
|
|
77
|
+
const gloss = 25 + 50 * rc("g");
|
|
78
|
+
const tagIn = ramp(frame, 8, 14);
|
|
79
|
+
|
|
80
|
+
const font = FONTS[props.font] ?? FONTS.display;
|
|
81
|
+
const weight = Number(props.weight) || 800;
|
|
82
|
+
const markSize = fontSize * 0.78;
|
|
83
|
+
|
|
84
|
+
// The peel: the bottom-right corner is cut away and folded back over the sticker.
|
|
85
|
+
const fold = circle ? diameter * 0.26 : Math.min(boxH * 0.5, fontSize * 0.62);
|
|
86
|
+
const fw = circle ? diameter : boxW;
|
|
87
|
+
const fh = circle ? diameter : boxH;
|
|
88
|
+
const peel = props.peel && !textCut;
|
|
89
|
+
const peelClip = peel
|
|
90
|
+
? `polygon(0% 0%, 100% 0%, 100% ${(100 - (fold / fh) * 100).toFixed(2)}%, ${(100 - (fold / fw) * 100).toFixed(2)}% 100%, 0% 100%)`
|
|
91
|
+
: undefined;
|
|
92
|
+
const radius = circle ? diameter / 2 : props.shape === "pill" ? boxH / 2 : fontSize * 0.38;
|
|
93
|
+
|
|
94
|
+
const mark = hasMark ? (
|
|
95
|
+
<MarkIcon
|
|
96
|
+
kind={props.mark}
|
|
97
|
+
size={markSize}
|
|
98
|
+
color={textCut ? props.color : props.textColor}
|
|
99
|
+
stroke={textCut ? props.border : undefined}
|
|
100
|
+
strokeWidth={(bw * 2 * 100) / markSize}
|
|
101
|
+
/>
|
|
102
|
+
) : null;
|
|
103
|
+
|
|
104
|
+
const word = (
|
|
105
|
+
<span style={{ fontFamily: font, fontWeight: weight, fontSize, lineHeight: 1.05, whiteSpace: "nowrap", letterSpacing: "-0.02em" }}>
|
|
106
|
+
{props.name}
|
|
107
|
+
</span>
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
let sticker: ReactNode;
|
|
111
|
+
if (textCut) {
|
|
112
|
+
sticker = (
|
|
113
|
+
<div
|
|
114
|
+
style={{
|
|
115
|
+
display: "flex",
|
|
116
|
+
alignItems: "center",
|
|
117
|
+
gap: fontSize * 0.22,
|
|
118
|
+
color: props.color,
|
|
119
|
+
textShadow: dieCutShadow(bw, props.border, shadowOff, shadowBlur, shadowAlpha),
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
{mark}
|
|
123
|
+
{word}
|
|
124
|
+
</div>
|
|
125
|
+
);
|
|
126
|
+
} else {
|
|
127
|
+
const size = circle ? { width: diameter, height: diameter } : {};
|
|
128
|
+
sticker = (
|
|
129
|
+
<div style={{ position: "relative", ...size }}>
|
|
130
|
+
{/* The drop shadow is its own shape so the peel can cut it too. */}
|
|
131
|
+
<div
|
|
132
|
+
style={{
|
|
133
|
+
position: "absolute",
|
|
134
|
+
inset: 0,
|
|
135
|
+
transform: `translate(${shadowOff * 0.35}px, ${shadowOff}px)`,
|
|
136
|
+
...blurStyle(shadowBlur),
|
|
137
|
+
}}
|
|
138
|
+
>
|
|
139
|
+
<div
|
|
140
|
+
style={{
|
|
141
|
+
width: "100%",
|
|
142
|
+
height: "100%",
|
|
143
|
+
borderRadius: radius,
|
|
144
|
+
background: `rgba(0, 0, 0, ${shadowAlpha.toFixed(3)})`,
|
|
145
|
+
clipPath: peelClip,
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
</div>
|
|
149
|
+
<div
|
|
150
|
+
style={{
|
|
151
|
+
position: "relative",
|
|
152
|
+
...size,
|
|
153
|
+
padding: bw,
|
|
154
|
+
borderRadius: radius,
|
|
155
|
+
background: props.border,
|
|
156
|
+
clipPath: peelClip,
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<div
|
|
160
|
+
style={{
|
|
161
|
+
position: "relative",
|
|
162
|
+
overflow: "hidden",
|
|
163
|
+
width: circle ? "100%" : undefined,
|
|
164
|
+
height: circle ? "100%" : undefined,
|
|
165
|
+
display: "flex",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
justifyContent: "center",
|
|
168
|
+
gap: fontSize * 0.22,
|
|
169
|
+
padding: circle ? 0 : `${padY}px ${padX}px`,
|
|
170
|
+
borderRadius: circle ? "50%" : Math.max(0, radius - bw),
|
|
171
|
+
background: props.color,
|
|
172
|
+
color: props.textColor,
|
|
173
|
+
}}
|
|
174
|
+
>
|
|
175
|
+
{mark}
|
|
176
|
+
{word}
|
|
177
|
+
{/* Gloss: a soft top light and a slanted sheen that moves with every new surface. */}
|
|
178
|
+
<div
|
|
179
|
+
style={{
|
|
180
|
+
position: "absolute",
|
|
181
|
+
inset: 0,
|
|
182
|
+
background: "linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 55%)",
|
|
183
|
+
}}
|
|
184
|
+
/>
|
|
185
|
+
<div
|
|
186
|
+
style={{
|
|
187
|
+
position: "absolute",
|
|
188
|
+
inset: 0,
|
|
189
|
+
background: `linear-gradient(115deg, rgba(255,255,255,0) ${gloss - 16}%, rgba(255,255,255,0.32) ${gloss}%, rgba(255,255,255,0) ${gloss + 12}%)`,
|
|
190
|
+
}}
|
|
191
|
+
/>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
{peel ? (
|
|
195
|
+
<>
|
|
196
|
+
<div
|
|
197
|
+
style={{
|
|
198
|
+
position: "absolute",
|
|
199
|
+
right: 0,
|
|
200
|
+
bottom: 0,
|
|
201
|
+
width: fold * 1.12,
|
|
202
|
+
height: fold * 1.12,
|
|
203
|
+
background: "rgba(0, 0, 0, 0.28)",
|
|
204
|
+
clipPath: "polygon(0% 0%, 100% 0%, 0% 100%)",
|
|
205
|
+
borderTopLeftRadius: Math.min(fold, radius),
|
|
206
|
+
transform: `translate(${-fold * 0.08}px, ${-fold * 0.08}px)`,
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
<div
|
|
210
|
+
style={{
|
|
211
|
+
position: "absolute",
|
|
212
|
+
right: 0,
|
|
213
|
+
bottom: 0,
|
|
214
|
+
width: fold,
|
|
215
|
+
height: fold,
|
|
216
|
+
background: "linear-gradient(135deg, #ffffff 0%, #ececec 30%, #c4c4c4 50%)",
|
|
217
|
+
clipPath: "polygon(0% 0%, 100% 0%, 0% 100%)",
|
|
218
|
+
borderTopLeftRadius: Math.min(fold, radius),
|
|
219
|
+
}}
|
|
220
|
+
/>
|
|
221
|
+
</>
|
|
222
|
+
) : null}
|
|
223
|
+
</div>
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<AbsoluteFill style={{ background: "#0b0b0d", opacity: out }}>
|
|
229
|
+
{images.length ? (
|
|
230
|
+
<AbsoluteFill style={{ overflow: "hidden" }}>
|
|
231
|
+
<Img
|
|
232
|
+
src={images[index]}
|
|
233
|
+
crossOrigin="anonymous"
|
|
234
|
+
style={{
|
|
235
|
+
width: "100%",
|
|
236
|
+
height: "100%",
|
|
237
|
+
objectFit: "cover",
|
|
238
|
+
transform: `scale(${(1.06 + 0.12 * rc("zs")) * (1 + 0.006 * local)}) translate(${(rc("zx") - 0.5) * 4}%, ${(rc("zy") - 0.5) * 4}%)`,
|
|
239
|
+
}}
|
|
240
|
+
/>
|
|
241
|
+
</AbsoluteFill>
|
|
242
|
+
) : (
|
|
243
|
+
<Surface index={index} width={width} height={height} u={u} id={id} r={rc} local={local} />
|
|
244
|
+
)}
|
|
245
|
+
<svg width={width} height={height} style={{ position: "absolute", inset: 0 }}>
|
|
246
|
+
<defs>
|
|
247
|
+
<radialGradient id={`${id}-vig`} cx="50%" cy="50%" r="75%">
|
|
248
|
+
<stop offset="55%" stopColor="#000000" stopOpacity={0} />
|
|
249
|
+
<stop offset="100%" stopColor="#000000" stopOpacity={0.5} />
|
|
250
|
+
</radialGradient>
|
|
251
|
+
</defs>
|
|
252
|
+
<rect width={width} height={height} fill={`url(#${id}-vig)`} />
|
|
253
|
+
</svg>
|
|
254
|
+
<AbsoluteFill style={{ alignItems: "center", justifyContent: "center" }}>
|
|
255
|
+
<div style={{ display: "flex", flexDirection: "column", alignItems: "center", gap: fontSize * 0.6 }}>
|
|
256
|
+
<div
|
|
257
|
+
style={{
|
|
258
|
+
opacity: ramp(frame, 0, 3),
|
|
259
|
+
transform: `translate(${jx}px, ${jy}px) rotate(${angle.toFixed(2)}deg) skewX(${skew.toFixed(2)}deg) scale(${scale.toFixed(4)})`,
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
{sticker}
|
|
263
|
+
</div>
|
|
264
|
+
{props.tagline ? (
|
|
265
|
+
<div
|
|
266
|
+
style={{
|
|
267
|
+
fontFamily: FONTS.mono,
|
|
268
|
+
fontSize: Math.max(14, fontSize * 0.2),
|
|
269
|
+
fontWeight: 500,
|
|
270
|
+
letterSpacing: "0.22em",
|
|
271
|
+
textTransform: "uppercase",
|
|
272
|
+
color: "#ffffff",
|
|
273
|
+
background: "rgba(10, 10, 12, 0.82)",
|
|
274
|
+
padding: `${fontSize * 0.09}px ${fontSize * 0.22}px`,
|
|
275
|
+
borderRadius: 999,
|
|
276
|
+
whiteSpace: "nowrap",
|
|
277
|
+
opacity: tagIn,
|
|
278
|
+
transform: `translateY(${(1 - tagIn) * 20 * u}px)`,
|
|
279
|
+
}}
|
|
280
|
+
>
|
|
281
|
+
{props.tagline}
|
|
282
|
+
</div>
|
|
283
|
+
) : null}
|
|
284
|
+
</div>
|
|
285
|
+
</AbsoluteFill>
|
|
286
|
+
{props.flash && cut > 0 && local === 0 ? <AbsoluteFill style={{ background: "#ffffff", opacity: 0.7 }} /> : null}
|
|
287
|
+
</AbsoluteFill>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/** Rough advance width per character, in ems, so long names shrink to fit. */
|
|
292
|
+
const CHAR_WIDTH: Record<string, number> = {
|
|
293
|
+
sans: 0.58,
|
|
294
|
+
display: 0.56,
|
|
295
|
+
serif: 0.46,
|
|
296
|
+
fraunces: 0.55,
|
|
297
|
+
grotesk: 0.58,
|
|
298
|
+
syne: 0.66,
|
|
299
|
+
wide: 0.82,
|
|
300
|
+
condensed: 0.44,
|
|
301
|
+
mono: 0.62,
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
/** The surface for cut n: walks the cuts so two neighbours never share one. */
|
|
305
|
+
function sequence(cut: number, count: number, seed: number) {
|
|
306
|
+
let index = Math.floor(random(`${seed}-pick-0`) * count);
|
|
307
|
+
for (let c = 1; c <= cut; c++) index = (index + 1 + Math.floor(random(`${seed}-pick-${c}`) * (count - 1))) % count;
|
|
308
|
+
return index;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** A die-cut outline that follows the letters: rings of shadow copies, then a soft drop shadow. */
|
|
312
|
+
function dieCutShadow(bw: number, border: string, off: number, blur: number, alphaValue: number) {
|
|
313
|
+
const ring = (r: number, steps: number, color: string, dx = 0, dy = 0, b = 0) =>
|
|
314
|
+
Array.from({ length: steps }, (_, i) => {
|
|
315
|
+
const a = (i / steps) * Math.PI * 2;
|
|
316
|
+
return `${(Math.cos(a) * r + dx).toFixed(1)}px ${(Math.sin(a) * r + dy).toFixed(1)}px ${b.toFixed(1)}px ${color}`;
|
|
317
|
+
});
|
|
318
|
+
return [
|
|
319
|
+
...ring(bw, 24, border),
|
|
320
|
+
...ring(bw * 0.5, 12, border),
|
|
321
|
+
...ring(bw, 10, `rgba(0, 0, 0, ${(alphaValue * 0.6).toFixed(3)})`, off * 0.35, off, blur),
|
|
322
|
+
].join(", ");
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function MarkIcon({ kind, size, color, stroke, strokeWidth }: { kind: string; size: number; color: string; stroke?: string; strokeWidth: number }) {
|
|
326
|
+
const paint = { fill: color, stroke, strokeWidth: stroke ? strokeWidth : 0, strokeLinejoin: "round" as const, paintOrder: "stroke" };
|
|
327
|
+
return (
|
|
328
|
+
<svg width={size} height={size} viewBox="0 0 100 100" style={{ overflow: "visible", flexShrink: 0 }}>
|
|
329
|
+
{kind === "dot" ? <circle cx={50} cy={50} r={44} {...paint} /> : null}
|
|
330
|
+
{kind === "star" ? <polygon points={starPoints()} {...paint} /> : null}
|
|
331
|
+
{kind === "bolt" ? <polygon points="60,2 14,58 44,58 36,98 86,38 56,38 64,2" {...paint} /> : null}
|
|
332
|
+
{kind === "heart" ? (
|
|
333
|
+
<path d="M50 90 C 20 68, 4 50, 4 30 C 4 14, 16 4, 30 4 C 40 4, 47 10, 50 18 C 53 10, 60 4, 70 4 C 84 4, 96 14, 96 30 C 96 50, 80 68, 50 90 Z" {...paint} />
|
|
334
|
+
) : null}
|
|
335
|
+
</svg>
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function starPoints() {
|
|
340
|
+
return Array.from({ length: 10 }, (_, i) => {
|
|
341
|
+
const a = -Math.PI / 2 + (i * Math.PI) / 5;
|
|
342
|
+
const r = i % 2 === 0 ? 48 : 21;
|
|
343
|
+
return `${(50 + Math.cos(a) * r).toFixed(1)},${(52 + Math.sin(a) * r).toFixed(1)}`;
|
|
344
|
+
}).join(" ");
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// ---------------------------------------------------------------------------------------------
|
|
348
|
+
// Surfaces: drawn in SVG (patterns and turbulence, which the export draws exactly), varied per cut.
|
|
349
|
+
|
|
350
|
+
type SurfaceArgs = { w: number; h: number; u: number; id: string; r: (k: string) => number; n: number };
|
|
351
|
+
|
|
352
|
+
const pick = <T,>(list: readonly T[], v: number) => list[Math.min(list.length - 1, Math.floor(v * list.length))];
|
|
353
|
+
|
|
354
|
+
/** A hex color mixed toward black (t < 0) or white (t > 0). */
|
|
355
|
+
function shade(hex: string, t: number) {
|
|
356
|
+
const m = /^#?([0-9a-f]{6})$/i.exec(hex.trim());
|
|
357
|
+
if (!m) return hex;
|
|
358
|
+
const v = parseInt(m[1], 16);
|
|
359
|
+
const target = t < 0 ? 0 : 255;
|
|
360
|
+
const k = Math.abs(t);
|
|
361
|
+
const c = (x: number) => Math.round(x + (target - x) * k);
|
|
362
|
+
return `rgb(${c((v >> 16) & 255)}, ${c((v >> 8) & 255)}, ${c(v & 255)})`;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/** Turbulence as a texture layer: alpha = a·noise + b, in one flat color. */
|
|
366
|
+
function noise(
|
|
367
|
+
id: string,
|
|
368
|
+
w: number,
|
|
369
|
+
h: number,
|
|
370
|
+
o: { fx: number; fy?: number; oct?: number; seed: number; a: number; b: number; rgb?: [number, number, number]; opacity?: number },
|
|
371
|
+
) {
|
|
372
|
+
const [cr, cg, cb] = o.rgb ?? [0, 0, 0];
|
|
373
|
+
return (
|
|
374
|
+
<g key={id}>
|
|
375
|
+
<filter id={id} x="0" y="0" width="100%" height="100%" colorInterpolationFilters="sRGB">
|
|
376
|
+
<feTurbulence type="fractalNoise" baseFrequency={`${o.fx} ${o.fy ?? o.fx}`} numOctaves={o.oct ?? 2} seed={o.seed} />
|
|
377
|
+
<feColorMatrix type="matrix" values={`0 0 0 0 ${cr} 0 0 0 0 ${cg} 0 0 0 0 ${cb} ${o.a} 0 0 0 ${o.b}`} />
|
|
378
|
+
</filter>
|
|
379
|
+
<rect width={w} height={h} filter={`url(#${id})`} opacity={o.opacity ?? 1} />
|
|
380
|
+
</g>
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** A sheen: a soft diagonal band of light across the whole surface. */
|
|
385
|
+
function sheen(id: string, w: number, h: number, strength: number, at = 0.45) {
|
|
386
|
+
return (
|
|
387
|
+
<g key={id}>
|
|
388
|
+
<linearGradient id={id} x1="0" y1="0" x2="1" y2="1">
|
|
389
|
+
<stop offset={at - 0.2} stopColor="#ffffff" stopOpacity={0} />
|
|
390
|
+
<stop offset={at} stopColor="#ffffff" stopOpacity={strength} />
|
|
391
|
+
<stop offset={at + 0.18} stopColor="#ffffff" stopOpacity={0} />
|
|
392
|
+
</linearGradient>
|
|
393
|
+
<rect width={w} height={h} fill={`url(#${id})`} />
|
|
394
|
+
</g>
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const STICKER_COLORS = ["#ff5d8f", "#ffd166", "#06d6a0", "#118ab2", "#ef476f", "#8338ec", "#f8f9fa", "#ff8c42"];
|
|
399
|
+
|
|
400
|
+
function laptop({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
401
|
+
const [a, b, c] = pick(
|
|
402
|
+
[
|
|
403
|
+
["#e4e6e9", "#b3b7bd", "#d2d5da"],
|
|
404
|
+
["#9b9ea4", "#63666c", "#86898f"],
|
|
405
|
+
["#3b414d", "#1f232b", "#2f3541"],
|
|
406
|
+
["#e9dccd", "#b9a28b", "#d9c5b1"],
|
|
407
|
+
],
|
|
408
|
+
r("tone"),
|
|
409
|
+
);
|
|
410
|
+
const x0 = -w * 0.15;
|
|
411
|
+
const y0 = -h * 0.15;
|
|
412
|
+
const lw = w * (1.03 + 0.05 * r("lw"));
|
|
413
|
+
const lh = h * (1.02 + 0.05 * r("lh"));
|
|
414
|
+
const rx = 70 * u;
|
|
415
|
+
const spots = [
|
|
416
|
+
[0.13, 0.17],
|
|
417
|
+
[0.87, 0.14],
|
|
418
|
+
[0.15, 0.84],
|
|
419
|
+
[0.78, 0.8],
|
|
420
|
+
[0.5, 0.08],
|
|
421
|
+
];
|
|
422
|
+
const start = Math.floor(r("sp") * spots.length);
|
|
423
|
+
return (
|
|
424
|
+
<>
|
|
425
|
+
<rect width={w} height={h} fill="#0d0e10" />
|
|
426
|
+
<linearGradient id={`${id}-al`} x1="0" y1="0" x2="1" y2="1">
|
|
427
|
+
<stop offset="0" stopColor={a} />
|
|
428
|
+
<stop offset="0.55" stopColor={b} />
|
|
429
|
+
<stop offset="1" stopColor={c} />
|
|
430
|
+
</linearGradient>
|
|
431
|
+
<clipPath id={`${id}-lid`}>
|
|
432
|
+
<rect x={x0} y={y0} width={lw} height={lh} rx={rx} />
|
|
433
|
+
</clipPath>
|
|
434
|
+
<rect x={x0} y={y0} width={lw} height={lh} rx={rx} fill={`url(#${id}-al)`} />
|
|
435
|
+
<g clipPath={`url(#${id}-lid)`}>
|
|
436
|
+
{noise(`${id}-brush`, w, h, { fx: 0.0015 / u, fy: 0.5 / u, oct: 2, seed: n, a: 0.35, b: -0.08 })}
|
|
437
|
+
{sheen(`${id}-sh`, w, h, 0.22, 0.35 + 0.3 * r("sh"))}
|
|
438
|
+
{[0, 1, 2].map((i) => {
|
|
439
|
+
const [sx, sy] = spots[(start + i * 2) % spots.length];
|
|
440
|
+
const x = (sx + (r(`mx${i}`) - 0.5) * 0.04) * w;
|
|
441
|
+
const y = (sy + (r(`my${i}`) - 0.5) * 0.04) * h;
|
|
442
|
+
const fill = pick(STICKER_COLORS, r(`mc${i}`));
|
|
443
|
+
const rot = (r(`mr${i}`) - 0.5) * 50;
|
|
444
|
+
const round = r(`ms${i}`) > 0.5;
|
|
445
|
+
const s = (0.8 + 0.5 * r(`mz${i}`)) * u;
|
|
446
|
+
return (
|
|
447
|
+
<g key={i} transform={`translate(${x} ${y}) rotate(${rot}) scale(${s})`}>
|
|
448
|
+
{round ? (
|
|
449
|
+
<circle r={78} fill={fill} stroke="#ffffff" strokeWidth={12} />
|
|
450
|
+
) : (
|
|
451
|
+
<rect x={-100} y={-55} width={200} height={110} rx={55} fill={fill} stroke="#ffffff" strokeWidth={12} />
|
|
452
|
+
)}
|
|
453
|
+
</g>
|
|
454
|
+
);
|
|
455
|
+
})}
|
|
456
|
+
</g>
|
|
457
|
+
<rect x={x0} y={y0} width={lw} height={lh} rx={rx} fill="none" stroke="#ffffff" strokeOpacity={0.35} strokeWidth={4 * u} />
|
|
458
|
+
</>
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function brick({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
463
|
+
const [bricks, mortar] = pick(
|
|
464
|
+
[
|
|
465
|
+
[["#8e3b26", "#a2472e", "#7a3020", "#b0563a", "#963f29"], "#b7ab98"],
|
|
466
|
+
[["#e9e4da", "#ddd7cb", "#f1ede5", "#d6cfc2", "#e4ded2"], "#bdb8ae"],
|
|
467
|
+
[["#2b2b2e", "#323236", "#26262a", "#38383c", "#2e2e31"], "#4a4a4e"],
|
|
468
|
+
[["#a5643f", "#b87650", "#94583a", "#c08560", "#9d5e3c"], "#c2b39c"],
|
|
469
|
+
] as const,
|
|
470
|
+
r("tone"),
|
|
471
|
+
);
|
|
472
|
+
const bw = 230 * u;
|
|
473
|
+
const bh = 76 * u;
|
|
474
|
+
const m = 12 * u;
|
|
475
|
+
const tile = (x: number, y: number, i: number) => (
|
|
476
|
+
<rect key={`${x}-${y}`} x={x + m / 2} y={y + m / 2} width={bw - m} height={bh - m} rx={4 * u} fill={bricks[i % bricks.length]} />
|
|
477
|
+
);
|
|
478
|
+
return (
|
|
479
|
+
<>
|
|
480
|
+
<pattern
|
|
481
|
+
id={`${id}-p`}
|
|
482
|
+
width={bw * 4}
|
|
483
|
+
height={bh * 2}
|
|
484
|
+
patternUnits="userSpaceOnUse"
|
|
485
|
+
patternTransform={`translate(${r("px") * bw} ${r("py") * bh})`}
|
|
486
|
+
>
|
|
487
|
+
<rect width={bw * 4} height={bh * 2} fill={mortar} />
|
|
488
|
+
{[0, 1, 2, 3].map((k) => tile(k * bw, 0, k * 2 + 1))}
|
|
489
|
+
{[0, 1, 2, 3, 4].map((k) => tile(-bw / 2 + k * bw, bh, k === 4 ? 2 : k * 3 + 2))}
|
|
490
|
+
</pattern>
|
|
491
|
+
<rect width={w} height={h} fill={`url(#${id}-p)`} />
|
|
492
|
+
{noise(`${id}-weather`, w, h, { fx: 0.005 / u, oct: 4, seed: n, a: 1.1, b: -0.45 })}
|
|
493
|
+
{noise(`${id}-grain`, w, h, { fx: 0.9 / u, oct: 1, seed: n + 3, a: 0.9, b: -0.3 })}
|
|
494
|
+
<linearGradient id={`${id}-l`} x1="0" y1="0" x2="0" y2="1">
|
|
495
|
+
<stop offset="0" stopColor="#ffffff" stopOpacity={0.12} />
|
|
496
|
+
<stop offset="1" stopColor="#000000" stopOpacity={0.35} />
|
|
497
|
+
</linearGradient>
|
|
498
|
+
<rect width={w} height={h} fill={`url(#${id}-l)`} />
|
|
499
|
+
</>
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function skateDeck({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
504
|
+
const wood = pick(["#c8925a", "#d9a86c", "#a86b3c", "#e0bf8f"], r("tone"));
|
|
505
|
+
const plies = ["#e63946", "#1d3557", "#f1c453", "#2a9d8f", "#111111", "#f4a261"];
|
|
506
|
+
const top = h * (0.08 + 0.05 * r("top"));
|
|
507
|
+
const ply = 9 * u;
|
|
508
|
+
const boltX = (r("side") > 0.5 ? 0.86 : 0.14) * w;
|
|
509
|
+
return (
|
|
510
|
+
<>
|
|
511
|
+
<rect width={w} height={h} fill={wood} />
|
|
512
|
+
{noise(`${id}-grain`, w, h, { fx: 0.0018 / u, fy: 0.06 / u, oct: 3, seed: n, a: 1.5, b: -0.62, rgb: [0.28, 0.14, 0.05] })}
|
|
513
|
+
{noise(`${id}-fine`, w, h, { fx: 0.004 / u, fy: 0.9 / u, oct: 1, seed: n + 1, a: 0.5, b: -0.18, rgb: [0.3, 0.16, 0.06] })}
|
|
514
|
+
{/* The deck's edge: grip tape on top, then the dyed maple plies. */}
|
|
515
|
+
<rect width={w} height={top} fill="#141414" />
|
|
516
|
+
{noise(`${id}-grip`, w, top, { fx: 0.8 / u, oct: 1, seed: n + 2, a: 1, b: -0.55, rgb: [1, 1, 1] })}
|
|
517
|
+
{Array.from({ length: 6 }, (_, i) => (
|
|
518
|
+
<rect key={i} y={top + i * ply} width={w} height={ply} fill={i % 2 ? wood : pick(plies, r(`ply${i}`))} />
|
|
519
|
+
))}
|
|
520
|
+
<rect y={top + 6 * ply} width={w} height={6 * u} fill="#000000" opacity={0.25} />
|
|
521
|
+
{[-1, 1].flatMap((sx) =>
|
|
522
|
+
[-1, 1].map((sy) => {
|
|
523
|
+
const x = boltX + sx * 62 * u;
|
|
524
|
+
const y = h * 0.58 + sy * 70 * u;
|
|
525
|
+
return (
|
|
526
|
+
<g key={`${sx}${sy}`}>
|
|
527
|
+
<circle cx={x} cy={y + 3 * u} r={17 * u} fill="#000000" opacity={0.3} />
|
|
528
|
+
<circle cx={x} cy={y} r={16 * u} fill="#9ca3af" stroke="#4b5563" strokeWidth={2 * u} />
|
|
529
|
+
<path d={`M${x - 8 * u} ${y}H${x + 8 * u}M${x} ${y - 8 * u}V${y + 8 * u}`} stroke="#374151" strokeWidth={3.5 * u} />
|
|
530
|
+
</g>
|
|
531
|
+
);
|
|
532
|
+
}),
|
|
533
|
+
)}
|
|
534
|
+
{sheen(`${id}-sh`, w, h, 0.18, 0.3 + 0.4 * r("sh"))}
|
|
535
|
+
</>
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function streetSign({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
540
|
+
const [bg, ink] = pick(
|
|
541
|
+
[
|
|
542
|
+
["#0f6b45", "#ffffff"],
|
|
543
|
+
["#1747a6", "#ffffff"],
|
|
544
|
+
["#b91c1c", "#ffffff"],
|
|
545
|
+
["#f2c230", "#111111"],
|
|
546
|
+
["#6b3e1f", "#ffffff"],
|
|
547
|
+
] as const,
|
|
548
|
+
r("tone"),
|
|
549
|
+
);
|
|
550
|
+
const word = pick(["MAIN ST", "ONE WAY", "EXIT 24", "5TH AVE", "STOP", "NO PARKING", "SUNSET BLVD"], r("word"));
|
|
551
|
+
const inset = 44 * u;
|
|
552
|
+
const rivets = [
|
|
553
|
+
[inset + 46 * u, inset + 46 * u],
|
|
554
|
+
[w - inset - 46 * u, inset + 46 * u],
|
|
555
|
+
[inset + 46 * u, h - inset - 46 * u],
|
|
556
|
+
[w - inset - 46 * u, h - inset - 46 * u],
|
|
557
|
+
];
|
|
558
|
+
return (
|
|
559
|
+
<>
|
|
560
|
+
<rect width={w} height={h} fill={bg} />
|
|
561
|
+
<text
|
|
562
|
+
x={w * (0.04 - 0.3 * r("tx"))}
|
|
563
|
+
y={h * (0.4 + 0.5 * r("ty"))}
|
|
564
|
+
fill={ink}
|
|
565
|
+
opacity={0.92}
|
|
566
|
+
fontFamily="Arial, Helvetica, sans-serif"
|
|
567
|
+
fontWeight={700}
|
|
568
|
+
fontSize={h * 0.42}
|
|
569
|
+
letterSpacing={h * 0.01}
|
|
570
|
+
>
|
|
571
|
+
{word}
|
|
572
|
+
</text>
|
|
573
|
+
<rect x={inset} y={inset} width={w - inset * 2} height={h - inset * 2} rx={50 * u} fill="none" stroke={ink} strokeWidth={16 * u} />
|
|
574
|
+
{rivets.map(([x, y], i) => (
|
|
575
|
+
<g key={i}>
|
|
576
|
+
<circle cx={x} cy={y} r={15 * u} fill={shade(bg, -0.5)} />
|
|
577
|
+
<circle cx={x - 2 * u} cy={y - 2 * u} r={12 * u} fill="#d1d5db" />
|
|
578
|
+
<circle cx={x - 5 * u} cy={y - 5 * u} r={4 * u} fill="#ffffff" opacity={0.8} />
|
|
579
|
+
</g>
|
|
580
|
+
))}
|
|
581
|
+
{Array.from({ length: 14 }, (_, i) => {
|
|
582
|
+
const x = r(`sx${i}`) * w;
|
|
583
|
+
const y = r(`sy${i}`) * h;
|
|
584
|
+
const len = (40 + 160 * r(`sl${i}`)) * u;
|
|
585
|
+
const a = (r(`sa${i}`) - 0.5) * 0.8;
|
|
586
|
+
return (
|
|
587
|
+
<line
|
|
588
|
+
key={i}
|
|
589
|
+
x1={x}
|
|
590
|
+
y1={y}
|
|
591
|
+
x2={x + Math.cos(a) * len}
|
|
592
|
+
y2={y + Math.sin(a) * len}
|
|
593
|
+
stroke="#ffffff"
|
|
594
|
+
strokeOpacity={0.18}
|
|
595
|
+
strokeWidth={1.5 * u}
|
|
596
|
+
/>
|
|
597
|
+
);
|
|
598
|
+
})}
|
|
599
|
+
{noise(`${id}-grime`, w, h, { fx: 0.004 / u, oct: 4, seed: n, a: 1.2, b: -0.6 })}
|
|
600
|
+
{noise(`${id}-grain`, w, h, { fx: 0.7 / u, oct: 1, seed: n + 1, a: 0.5, b: -0.2 })}
|
|
601
|
+
{sheen(`${id}-sh`, w, h, 0.2, 0.3 + 0.3 * r("sh"))}
|
|
602
|
+
</>
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
function cardboard({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
607
|
+
const tone = pick(["#c69c6d", "#b98c5a", "#d2ab7c", "#a87d4f"], r("tone"));
|
|
608
|
+
const stamp = pick(["FRAGILE", "THIS SIDE UP", "HANDLE WITH CARE", "DO NOT CRUSH"], r("stamp"));
|
|
609
|
+
const step = 22 * u;
|
|
610
|
+
const tapeY = h * pick([0.18, 0.5, 0.82], r("ty"));
|
|
611
|
+
const tapeA = (r("ta") - 0.5) * 24;
|
|
612
|
+
const tapeH = 190 * u;
|
|
613
|
+
const sx = r("sx") > 0.5;
|
|
614
|
+
const stampSize = 96 * u;
|
|
615
|
+
const stampW = stamp.length * stampSize * 0.62;
|
|
616
|
+
return (
|
|
617
|
+
<>
|
|
618
|
+
<rect width={w} height={h} fill={tone} />
|
|
619
|
+
<pattern id={`${id}-c`} width={step} height={step} patternUnits="userSpaceOnUse">
|
|
620
|
+
<rect width={step * 0.45} height={step} fill="#000000" opacity={0.045} />
|
|
621
|
+
</pattern>
|
|
622
|
+
<rect width={w} height={h} fill={`url(#${id}-c)`} />
|
|
623
|
+
{noise(`${id}-fiber`, w, h, { fx: 0.5 / u, oct: 2, seed: n, a: 0.8, b: -0.32, rgb: [0.25, 0.15, 0.05] })}
|
|
624
|
+
{noise(`${id}-blot`, w, h, { fx: 0.003 / u, oct: 3, seed: n + 1, a: 0.9, b: -0.45, rgb: [0.3, 0.18, 0.06] })}
|
|
625
|
+
<g transform={`rotate(-6 ${sx ? w * 0.75 : w * 0.25} ${h * 0.2})`} opacity={0.72}>
|
|
626
|
+
<rect
|
|
627
|
+
x={(sx ? w * 0.95 - stampW : w * 0.05) - 22 * u}
|
|
628
|
+
y={h * 0.08}
|
|
629
|
+
width={stampW + 44 * u}
|
|
630
|
+
height={stampSize * 1.3}
|
|
631
|
+
fill="none"
|
|
632
|
+
stroke="#b3261e"
|
|
633
|
+
strokeWidth={8 * u}
|
|
634
|
+
rx={10 * u}
|
|
635
|
+
/>
|
|
636
|
+
<text
|
|
637
|
+
x={sx ? w * 0.95 - stampW : w * 0.05}
|
|
638
|
+
y={h * 0.08 + stampSize * 1.03}
|
|
639
|
+
fill="#b3261e"
|
|
640
|
+
fontFamily="Arial, Helvetica, sans-serif"
|
|
641
|
+
fontWeight={900}
|
|
642
|
+
fontSize={stampSize}
|
|
643
|
+
>
|
|
644
|
+
{stamp}
|
|
645
|
+
</text>
|
|
646
|
+
</g>
|
|
647
|
+
{/* Packing tape. */}
|
|
648
|
+
<g transform={`rotate(${tapeA} ${w / 2} ${tapeY})`}>
|
|
649
|
+
<rect x={-w} y={tapeY - tapeH / 2} width={w * 3} height={tapeH} fill="#d8b77e" opacity={0.6} />
|
|
650
|
+
<rect x={-w} y={tapeY - tapeH / 2 + tapeH * 0.15} width={w * 3} height={tapeH * 0.18} fill="#ffffff" opacity={0.2} />
|
|
651
|
+
<rect x={-w} y={tapeY - tapeH / 2} width={w * 3} height={3 * u} fill="#000000" opacity={0.2} />
|
|
652
|
+
<rect x={-w} y={tapeY + tapeH / 2 - 3 * u} width={w * 3} height={3 * u} fill="#000000" opacity={0.2} />
|
|
653
|
+
</g>
|
|
654
|
+
</>
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
function concrete({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
659
|
+
const tone = pick(["#9a9893", "#7f7d79", "#b3afa7", "#6d6b68"], r("tone"));
|
|
660
|
+
const cracks = [0, 1].map((k) => {
|
|
661
|
+
let x = r(`cx${k}`) * w;
|
|
662
|
+
let y = k ? 0 : h;
|
|
663
|
+
let a = k ? Math.PI / 2 : -Math.PI / 2;
|
|
664
|
+
const pts = [`${x},${y}`];
|
|
665
|
+
for (let i = 0; i < 16; i++) {
|
|
666
|
+
a += (r(`ca${k}-${i}`) - 0.5) * 1.1;
|
|
667
|
+
const len = (30 + 40 * r(`cl${k}-${i}`)) * u;
|
|
668
|
+
x += Math.cos(a) * len;
|
|
669
|
+
y += Math.sin(a) * len;
|
|
670
|
+
pts.push(`${x.toFixed(1)},${y.toFixed(1)}`);
|
|
671
|
+
}
|
|
672
|
+
return pts.join(" ");
|
|
673
|
+
});
|
|
674
|
+
const stripeX = (r("st") > 0.5 ? 0.12 : 0.88) * w;
|
|
675
|
+
return (
|
|
676
|
+
<>
|
|
677
|
+
<rect width={w} height={h} fill={tone} />
|
|
678
|
+
{noise(`${id}-blot`, w, h, { fx: 0.004 / u, oct: 4, seed: n, a: 1.2, b: -0.5 })}
|
|
679
|
+
{noise(`${id}-light`, w, h, { fx: 0.012 / u, oct: 3, seed: n + 1, a: 0.9, b: -0.45, rgb: [1, 1, 1] })}
|
|
680
|
+
<rect x={stripeX - 60 * u} y={-h} width={120 * u} height={h * 3} fill="#e0b31c" opacity={0.85} transform={`rotate(${(r("sa") - 0.5) * 16} ${stripeX} ${h / 2})`} />
|
|
681
|
+
{noise(`${id}-grain`, w, h, { fx: 0.85 / u, oct: 1, seed: n + 2, a: 1, b: -0.35 })}
|
|
682
|
+
{cracks.map((pts, k) => (
|
|
683
|
+
<g key={k}>
|
|
684
|
+
<polyline points={pts} fill="none" stroke="#ffffff" strokeOpacity={0.14} strokeWidth={3 * u} transform={`translate(${1.5 * u} ${1.5 * u})`} />
|
|
685
|
+
<polyline points={pts} fill="none" stroke="#1a1a1a" strokeOpacity={0.6} strokeWidth={2.5 * u} strokeLinejoin="round" />
|
|
686
|
+
</g>
|
|
687
|
+
))}
|
|
688
|
+
</>
|
|
689
|
+
);
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function notebook({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
693
|
+
const paper = pick(["#fbf8ef", "#fdf3b0", "#f4f1ea"], r("tone"));
|
|
694
|
+
const line = 58 * u;
|
|
695
|
+
const rot = (r("rot") - 0.5) * 6;
|
|
696
|
+
const margin = w * 0.14;
|
|
697
|
+
const doodle = Array.from({ length: 9 }, (_, i) => {
|
|
698
|
+
const x = w * (r("dx") > 0.5 ? 0.62 : 0.2) + i * 34 * u;
|
|
699
|
+
const y = h * (0.82 + 0.06 * r("dy")) + (i % 2 ? -26 : 26) * u;
|
|
700
|
+
return `${i ? "L" : "M"}${x.toFixed(1)} ${y.toFixed(1)}`;
|
|
701
|
+
}).join(" ");
|
|
702
|
+
return (
|
|
703
|
+
<>
|
|
704
|
+
<rect width={w} height={h} fill="#2a211b" />
|
|
705
|
+
<g transform={`rotate(${rot} ${w / 2} ${h / 2})`}>
|
|
706
|
+
<rect x={-w * 0.04} y={-h * 0.1} width={w * 1.2} height={h * 1.2} fill={paper} />
|
|
707
|
+
<pattern id={`${id}-l`} width={w} height={line} patternUnits="userSpaceOnUse" patternTransform={`translate(0 ${r("ly") * line})`}>
|
|
708
|
+
<rect y={line - 2.5 * u} width={w} height={2.5 * u} fill="#8fb3e0" />
|
|
709
|
+
</pattern>
|
|
710
|
+
<rect x={-w * 0.04} y={h * 0.1} width={w * 1.2} height={h * 1.1} fill={`url(#${id}-l)`} />
|
|
711
|
+
<rect x={margin} y={-h * 0.1} width={3 * u} height={h * 1.2} fill="#e07a7a" />
|
|
712
|
+
{[0.2, 0.5, 0.8].map((y) => (
|
|
713
|
+
<circle key={y} cx={w * 0.045} cy={h * y} r={24 * u} fill="#2a211b" />
|
|
714
|
+
))}
|
|
715
|
+
{noise(`${id}-paper`, w, h, { fx: 0.6 / u, oct: 1, seed: n, a: 0.35, b: -0.12 })}
|
|
716
|
+
<path d={doodle} fill="none" stroke="#1d4ed8" strokeWidth={4 * u} strokeLinejoin="round" strokeLinecap="round" opacity={0.85} />
|
|
717
|
+
<circle cx={w * (r("cx") > 0.5 ? 0.86 : 0.24)} cy={h * 0.16} r={42 * u} fill="none" stroke="#1d4ed8" strokeWidth={4 * u} opacity={0.8} />
|
|
718
|
+
</g>
|
|
719
|
+
</>
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
function posters({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
724
|
+
const palette = ["#ff3b6b", "#ffd23f", "#2ec4b6", "#3a86ff", "#ff8c42", "#8338ec", "#06d6a0", "#f72585"];
|
|
725
|
+
const base = pick(palette, r("base"));
|
|
726
|
+
const words = ["LIVE", "SALE", "TONIGHT", "NEW", "DROP", "TOUR", "OPEN"];
|
|
727
|
+
const dot = 18 * u;
|
|
728
|
+
return (
|
|
729
|
+
<>
|
|
730
|
+
<rect width={w} height={h} fill={base} />
|
|
731
|
+
<pattern id={`${id}-dots`} width={dot} height={dot} patternUnits="userSpaceOnUse" patternTransform="rotate(20)">
|
|
732
|
+
<circle cx={dot / 2} cy={dot / 2} r={dot * 0.22} fill="#000000" opacity={0.18} />
|
|
733
|
+
</pattern>
|
|
734
|
+
{[0, 1, 2, 3].map((i) => {
|
|
735
|
+
const pw = w * (0.35 + 0.3 * r(`pw${i}`));
|
|
736
|
+
const ph = h * (0.45 + 0.4 * r(`ph${i}`));
|
|
737
|
+
const x = (r(`px${i}`) * 1.1 - 0.2) * w;
|
|
738
|
+
const y = (r(`py${i}`) * 1.1 - 0.25) * h;
|
|
739
|
+
const color = pick(palette, r(`pc${i}`));
|
|
740
|
+
const rot = (r(`pr${i}`) - 0.5) * 10;
|
|
741
|
+
return (
|
|
742
|
+
<g key={i} transform={`rotate(${rot} ${x + pw / 2} ${y + ph / 2})`}>
|
|
743
|
+
<rect x={x + 8 * u} y={y + 10 * u} width={pw} height={ph} fill="#000000" opacity={0.18} />
|
|
744
|
+
<rect x={x} y={y} width={pw} height={ph} fill={color} />
|
|
745
|
+
<rect x={x} y={y} width={pw} height={ph} fill={`url(#${id}-dots)`} />
|
|
746
|
+
<text x={x + 24 * u} y={y + ph * 0.42} fontFamily="Impact, 'Arial Black', Arial, sans-serif" fontWeight={900} fontSize={ph * 0.36} fill="#111111" opacity={0.85}>
|
|
747
|
+
{pick(words, r(`pt${i}`))}
|
|
748
|
+
</text>
|
|
749
|
+
</g>
|
|
750
|
+
);
|
|
751
|
+
})}
|
|
752
|
+
{noise(`${id}-wrinkle`, w, h, { fx: 0.008 / u, oct: 3, seed: n, a: 0.7, b: -0.32, rgb: [1, 1, 1] })}
|
|
753
|
+
{noise(`${id}-wrinkle2`, w, h, { fx: 0.008 / u, oct: 3, seed: n + 7, a: 0.7, b: -0.36 })}
|
|
754
|
+
</>
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function fridge({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
759
|
+
const color = pick(["#bfe5d2", "#f3ead7", "#d63a2f", "#1f1f22", "#a9c8e8"], r("tone"));
|
|
760
|
+
const handleX = (r("hx") > 0.5 ? 0.9 : 0.07) * w;
|
|
761
|
+
const gapY = h * (0.14 + 0.08 * r("gy"));
|
|
762
|
+
return (
|
|
763
|
+
<>
|
|
764
|
+
<linearGradient id={`${id}-body`} x1="0" y1="0" x2="1" y2="0">
|
|
765
|
+
<stop offset="0" stopColor={shade(color, 0.12)} />
|
|
766
|
+
<stop offset="0.55" stopColor={color} />
|
|
767
|
+
<stop offset="1" stopColor={shade(color, -0.2)} />
|
|
768
|
+
</linearGradient>
|
|
769
|
+
<rect width={w} height={h} fill={`url(#${id}-body)`} />
|
|
770
|
+
<linearGradient id={`${id}-spec`} x1="0" y1="0" x2="1" y2="0">
|
|
771
|
+
<stop offset="0" stopColor="#ffffff" stopOpacity={0} />
|
|
772
|
+
<stop offset="0.5" stopColor="#ffffff" stopOpacity={0.38} />
|
|
773
|
+
<stop offset="1" stopColor="#ffffff" stopOpacity={0} />
|
|
774
|
+
</linearGradient>
|
|
775
|
+
<rect x={w * (0.22 + 0.15 * r("sx"))} width={w * 0.16} height={h} fill={`url(#${id}-spec)`} />
|
|
776
|
+
<rect y={gapY} width={w} height={7 * u} fill="#000000" opacity={0.45} />
|
|
777
|
+
<rect y={gapY + 7 * u} width={w} height={2 * u} fill="#ffffff" opacity={0.35} />
|
|
778
|
+
<linearGradient id={`${id}-chrome`} x1="0" y1="0" x2="1" y2="0">
|
|
779
|
+
<stop offset="0" stopColor="#f5f5f5" />
|
|
780
|
+
<stop offset="0.4" stopColor="#9a9a9a" />
|
|
781
|
+
<stop offset="0.7" stopColor="#e8e8e8" />
|
|
782
|
+
<stop offset="1" stopColor="#6f6f6f" />
|
|
783
|
+
</linearGradient>
|
|
784
|
+
<rect x={handleX - 14 * u} y={gapY + 80 * u} width={44 * u} height={h * 0.5} rx={22 * u} fill="#000000" opacity={0.25} />
|
|
785
|
+
<rect x={handleX - 22 * u} y={gapY + 70 * u} width={44 * u} height={h * 0.5} rx={22 * u} fill={`url(#${id}-chrome)`} />
|
|
786
|
+
{[0, 1, 2].map((i) => {
|
|
787
|
+
const x = w * (0.15 + 0.7 * r(`mx${i}`));
|
|
788
|
+
const y = h * (r(`my${i}`) > 0.5 ? 0.06 + 0.06 * r(`mz${i}`) : 0.84 + 0.08 * r(`mz${i}`));
|
|
789
|
+
const fill = pick(STICKER_COLORS, r(`mc${i}`));
|
|
790
|
+
return (
|
|
791
|
+
<g key={i}>
|
|
792
|
+
<circle cx={x + 4 * u} cy={y + 6 * u} r={30 * u} fill="#000000" opacity={0.25} />
|
|
793
|
+
<circle cx={x} cy={y} r={30 * u} fill={fill} />
|
|
794
|
+
<circle cx={x - 9 * u} cy={y - 9 * u} r={9 * u} fill="#ffffff" opacity={0.45} />
|
|
795
|
+
</g>
|
|
796
|
+
);
|
|
797
|
+
})}
|
|
798
|
+
{noise(`${id}-grain`, w, h, { fx: 0.9 / u, oct: 1, seed: n, a: 0.2, b: -0.06 })}
|
|
799
|
+
</>
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
function bottle({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
804
|
+
const color = pick(["#2f6f5e", "#e76f51", "#264653", "#c9ada7", "#e9c46a", "#5e60ce", "#151515"], r("tone"));
|
|
805
|
+
const bwid = w * (h > w ? 0.9 : 0.72);
|
|
806
|
+
const x = (w - bwid) / 2;
|
|
807
|
+
return (
|
|
808
|
+
<>
|
|
809
|
+
<linearGradient id={`${id}-bg`} x1="0" y1="0" x2="0" y2="1">
|
|
810
|
+
<stop offset="0" stopColor="#253043" />
|
|
811
|
+
<stop offset="1" stopColor="#0d1016" />
|
|
812
|
+
</linearGradient>
|
|
813
|
+
<rect width={w} height={h} fill={`url(#${id}-bg)`} />
|
|
814
|
+
<linearGradient id={`${id}-cyl`} x1="0" y1="0" x2="1" y2="0">
|
|
815
|
+
<stop offset="0" stopColor={shade(color, -0.6)} />
|
|
816
|
+
<stop offset="0.16" stopColor={color} />
|
|
817
|
+
<stop offset="0.3" stopColor={shade(color, 0.3)} />
|
|
818
|
+
<stop offset="0.48" stopColor={color} />
|
|
819
|
+
<stop offset="0.84" stopColor={shade(color, -0.35)} />
|
|
820
|
+
<stop offset="1" stopColor={shade(color, -0.7)} />
|
|
821
|
+
</linearGradient>
|
|
822
|
+
<clipPath id={`${id}-clip`}>
|
|
823
|
+
<rect x={x} y={-h * 0.1} width={bwid} height={h * 1.2} rx={bwid * 0.12} />
|
|
824
|
+
</clipPath>
|
|
825
|
+
<g clipPath={`url(#${id}-clip)`}>
|
|
826
|
+
<rect x={x} y={-h * 0.1} width={bwid} height={h * 1.2} fill={`url(#${id}-cyl)`} />
|
|
827
|
+
{noise(`${id}-coat`, w, h, { fx: 1.1 / u, oct: 1, seed: n, a: 1.1, b: -0.5 })}
|
|
828
|
+
{noise(`${id}-coat2`, w, h, { fx: 1.1 / u, oct: 1, seed: n + 5, a: 0.8, b: -0.45, rgb: [1, 1, 1] })}
|
|
829
|
+
<filter id={`${id}-soft`} x="-50%" y="0" width="200%" height="100%">
|
|
830
|
+
<feGaussianBlur stdDeviation={10 * u} />
|
|
831
|
+
</filter>
|
|
832
|
+
<rect x={x + bwid * 0.26} y={-h * 0.1} width={bwid * 0.04} height={h * 1.2} fill="#ffffff" opacity={0.5} filter={`url(#${id}-soft)`} />
|
|
833
|
+
</g>
|
|
834
|
+
</>
|
|
835
|
+
);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function guitarCase({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
839
|
+
const tone = pick(["#151515", "#2a1d16", "#1c2a3a", "#3a1414"], r("tone"));
|
|
840
|
+
const thread = pick(["#d9c9a3", "#e5e7eb", "#f59e0b"], r("thread"));
|
|
841
|
+
const inset = 70 * u;
|
|
842
|
+
const latchX = w * (0.3 + 0.4 * r("lx"));
|
|
843
|
+
return (
|
|
844
|
+
<>
|
|
845
|
+
<rect width={w} height={h} fill={tone} />
|
|
846
|
+
{noise(`${id}-pebble`, w, h, { fx: 0.22 / u, oct: 2, seed: n, a: 1.3, b: -0.72, rgb: [1, 1, 1] })}
|
|
847
|
+
{noise(`${id}-pebble2`, w, h, { fx: 0.22 / u, oct: 2, seed: n + 9, a: 1.3, b: -0.5 })}
|
|
848
|
+
<rect x={inset - 30 * u} y={inset - 30 * u} width={w - (inset - 30 * u) * 2} height={h - (inset - 30 * u) * 2} rx={80 * u} fill="none" stroke="#050505" strokeWidth={30 * u} />
|
|
849
|
+
<rect x={inset - 38 * u} y={inset - 38 * u} width={w - (inset - 38 * u) * 2} height={h - (inset - 38 * u) * 2} rx={88 * u} fill="none" stroke="#ffffff" strokeOpacity={0.12} strokeWidth={3 * u} />
|
|
850
|
+
<rect
|
|
851
|
+
x={inset}
|
|
852
|
+
y={inset}
|
|
853
|
+
width={w - inset * 2}
|
|
854
|
+
height={h - inset * 2}
|
|
855
|
+
rx={60 * u}
|
|
856
|
+
fill="none"
|
|
857
|
+
stroke={thread}
|
|
858
|
+
strokeOpacity={0.85}
|
|
859
|
+
strokeWidth={4 * u}
|
|
860
|
+
strokeDasharray={`${22 * u} ${12 * u}`}
|
|
861
|
+
/>
|
|
862
|
+
<linearGradient id={`${id}-chrome`} x1="0" y1="0" x2="0" y2="1">
|
|
863
|
+
<stop offset="0" stopColor="#f3f4f6" />
|
|
864
|
+
<stop offset="0.5" stopColor="#8b8f96" />
|
|
865
|
+
<stop offset="1" stopColor="#d1d5db" />
|
|
866
|
+
</linearGradient>
|
|
867
|
+
<rect x={latchX - 90 * u} y={-20 * u} width={180 * u} height={90 * u} rx={14 * u} fill={`url(#${id}-chrome)`} />
|
|
868
|
+
<rect x={latchX - 30 * u} y={30 * u} width={60 * u} height={22 * u} rx={6 * u} fill="#4b5563" />
|
|
869
|
+
{sheen(`${id}-sh`, w, h, 0.1, 0.3 + 0.4 * r("sh"))}
|
|
870
|
+
</>
|
|
871
|
+
);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
function tiles({ w, h, u, id, r, n }: SurfaceArgs) {
|
|
875
|
+
const [tile, grout] = pick(
|
|
876
|
+
[
|
|
877
|
+
["#f4f4f0", "#c9c6bd"],
|
|
878
|
+
["#9fd8c5", "#e8efe9"],
|
|
879
|
+
["#1b1b1d", "#5a5a5a"],
|
|
880
|
+
["#2754c5", "#dfe4ee"],
|
|
881
|
+
["#e8b4a0", "#f3e7dc"],
|
|
882
|
+
] as const,
|
|
883
|
+
r("tone"),
|
|
884
|
+
);
|
|
885
|
+
const tw = 200 * u;
|
|
886
|
+
const th = 100 * u;
|
|
887
|
+
const g = 8 * u;
|
|
888
|
+
const one = (x: number, y: number) => (
|
|
889
|
+
<rect key={`${x}-${y}`} x={x + g / 2} y={y + g / 2} width={tw - g} height={th - g} rx={6 * u} fill={`url(#${id}-t)`} />
|
|
890
|
+
);
|
|
891
|
+
return (
|
|
892
|
+
<>
|
|
893
|
+
<linearGradient id={`${id}-t`} x1="0" y1="0" x2="0" y2="1">
|
|
894
|
+
<stop offset="0" stopColor={shade(tile, 0.25)} />
|
|
895
|
+
<stop offset="0.3" stopColor={tile} />
|
|
896
|
+
<stop offset="1" stopColor={shade(tile, -0.08)} />
|
|
897
|
+
</linearGradient>
|
|
898
|
+
<pattern id={`${id}-p`} width={tw} height={th * 2} patternUnits="userSpaceOnUse" patternTransform={`translate(${r("px") * tw} 0)`}>
|
|
899
|
+
<rect width={tw} height={th * 2} fill={grout} />
|
|
900
|
+
{one(0, 0)}
|
|
901
|
+
{one(-tw / 2, th)}
|
|
902
|
+
{one(tw / 2, th)}
|
|
903
|
+
</pattern>
|
|
904
|
+
<rect width={w} height={h} fill={`url(#${id}-p)`} />
|
|
905
|
+
{sheen(`${id}-sh`, w, h, 0.3, 0.25 + 0.5 * r("sh"))}
|
|
906
|
+
{noise(`${id}-grain`, w, h, { fx: 0.006 / u, oct: 3, seed: n, a: 0.5, b: -0.25 })}
|
|
907
|
+
</>
|
|
908
|
+
);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
const SURFACES = [laptop, brick, skateDeck, streetSign, cardboard, concrete, notebook, posters, fridge, bottle, guitarCase, tiles];
|
|
912
|
+
|
|
913
|
+
function Surface({
|
|
914
|
+
index,
|
|
915
|
+
width: w,
|
|
916
|
+
height: h,
|
|
917
|
+
u,
|
|
918
|
+
id,
|
|
919
|
+
r,
|
|
920
|
+
local,
|
|
921
|
+
}: {
|
|
922
|
+
index: number;
|
|
923
|
+
width: number;
|
|
924
|
+
height: number;
|
|
925
|
+
u: number;
|
|
926
|
+
id: string;
|
|
927
|
+
r: (k: string) => number;
|
|
928
|
+
local: number;
|
|
929
|
+
}) {
|
|
930
|
+
const draw = SURFACES[index % SURFACES.length];
|
|
931
|
+
// Each cut frames its surface differently: a bit closer, a bit turned, drifting in slowly.
|
|
932
|
+
const scale = (1.1 + 0.12 * r("zoom")) * (1 + 0.004 * local);
|
|
933
|
+
const rot = (r("turn") - 0.5) * 6;
|
|
934
|
+
return (
|
|
935
|
+
<svg width={w} height={h} style={{ position: "absolute", inset: 0 }}>
|
|
936
|
+
<g transform={`translate(${w / 2} ${h / 2}) rotate(${rot.toFixed(2)}) scale(${scale.toFixed(4)}) translate(${-w / 2} ${-h / 2})`}>
|
|
937
|
+
{draw({ w, h, u, id: `${id}-s${index}`, r, n: Math.floor(r("noise") * 1000) })}
|
|
938
|
+
</g>
|
|
939
|
+
</svg>
|
|
940
|
+
);
|
|
941
|
+
}
|