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,376 @@
|
|
|
1
|
+
// Cut-paper illustrations for the lyrics. Each motif is a few paper pieces (SVG, rough-cut edges + drop shadow)
|
|
2
|
+
// that slap onto the wall one after another, then move in stop-motion steps (12 fps).
|
|
3
|
+
// kind: garden pot wheel cheer sun dumbbell calendar medal house palm glasses sprout crown maple hearts hearts2
|
|
4
|
+
// notes bolt bolt2 food camera vinyl clock badge53 heartbeat cake chain
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { AbsoluteFill, useCurrentFrame } from "remotion";
|
|
7
|
+
import type { SceneProps } from "agentcut";
|
|
8
|
+
import { P, areas, easeIn, hash, jit, q12, slap, st, beatPulse, type Side } from "./lib/punk";
|
|
9
|
+
|
|
10
|
+
type Props = SceneProps & { kind: string; side?: Side; seed?: number; x?: number; y?: number; scale?: number;
|
|
11
|
+
mobile?: { x?: number; y?: number; scale?: number };
|
|
12
|
+
ox?: number; oy?: number; // offset from the picture-area center, in picture sizes (stickers on a photo corner)
|
|
13
|
+
}; // placement override for vertical variants
|
|
14
|
+
|
|
15
|
+
// ---------- shape helpers (600×600 box) ----------
|
|
16
|
+
const star = (cx: number, cy: number, n: number, r1: number, r2: number, rot = 0) => {
|
|
17
|
+
let d = "";
|
|
18
|
+
for (let i = 0; i < n * 2; i++) {
|
|
19
|
+
const a = (Math.PI * i) / n + rot - Math.PI / 2;
|
|
20
|
+
const r = i % 2 ? r2 : r1;
|
|
21
|
+
d += `${i ? "L" : "M"}${(cx + Math.cos(a) * r).toFixed(1)} ${(cy + Math.sin(a) * r).toFixed(1)} `;
|
|
22
|
+
}
|
|
23
|
+
return d + "Z";
|
|
24
|
+
};
|
|
25
|
+
const heart = (cx: number, cy: number, s: number) =>
|
|
26
|
+
`M${cx} ${cy + s * 0.9} C${cx - s * 1.4} ${cy - s * 0.1} ${cx - s * 0.9} ${cy - s * 1.1} ${cx} ${cy - s * 0.45} C${cx + s * 0.9} ${cy - s * 1.1} ${cx + s * 1.4} ${cy - s * 0.1} ${cx} ${cy + s * 0.9} Z`;
|
|
27
|
+
const leaf = (len: number, w: number) => `M0 0 C${len * 0.3} ${-w} ${len * 0.7} ${-w} ${len} 0 C${len * 0.7} ${w} ${len * 0.3} ${w} 0 0 Z`;
|
|
28
|
+
const note = (x: number, y: number, c: string) => (
|
|
29
|
+
<g>
|
|
30
|
+
<ellipse cx={x} cy={y} rx={30} ry={22} transform={`rotate(-20 ${x} ${y})`} fill={c} />
|
|
31
|
+
<rect x={x + 22} y={y - 120} width={12} height={122} fill={c} />
|
|
32
|
+
<path d={`M${x + 22} ${y - 120} q 50 20 40 70 q -10 -30 -40 -35 Z`} fill={c} />
|
|
33
|
+
</g>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
type Pc = { node: React.ReactNode; at: number; cx: number; cy: number; tf?: string; stroke?: boolean };
|
|
37
|
+
|
|
38
|
+
function pieces(kind: string, f: number, abs: number, seed: number): { list: Pc[]; html?: React.ReactNode } {
|
|
39
|
+
const t = q12(f); // stepped time
|
|
40
|
+
const pulse = beatPulse(abs, 8);
|
|
41
|
+
const sway = (amp: number, per = 40, ph = 0) => Math.sin(((t + ph) / per) * Math.PI * 2) * amp;
|
|
42
|
+
const W = P.white;
|
|
43
|
+
switch (kind) {
|
|
44
|
+
case "garden":
|
|
45
|
+
return { list: [
|
|
46
|
+
{ at: 2, cx: 300, cy: 520, node: <path d="M40 480 L560 470 L575 570 L30 580 Z" fill={P.kraft} /> },
|
|
47
|
+
{ at: 5, cx: 300, cy: 470, tf: `rotate(${sway(3)} 300 470)`, node: <rect x={290} y={200} width={20} height={280} fill={P.green} /> },
|
|
48
|
+
{ at: 7, cx: 300, cy: 380, tf: `rotate(${sway(6, 30)} 300 380)`, node: <path d={leaf(170, 45)} transform="translate(300 380) rotate(-30)" fill={P.green} /> },
|
|
49
|
+
{ at: 9, cx: 300, cy: 330, tf: `rotate(${sway(-6, 30)} 300 330)`, node: <path d={leaf(150, 40)} transform="translate(300 330) rotate(-150)" fill="#2E7D32" /> },
|
|
50
|
+
{ at: 12, cx: 300, cy: 190, tf: `rotate(${t * 1.5} 300 190)`, node: <g>{Array.from({ length: 8 }).map((_, i) => <circle key={i} cx={300 + Math.cos((i * Math.PI) / 4) * 70} cy={190 + Math.sin((i * Math.PI) / 4) * 70} r={48} fill={P.pink} />)}</g> },
|
|
51
|
+
{ at: 14, cx: 300, cy: 190, node: <circle cx={300} cy={190} r={50} fill={P.yellow} /> },
|
|
52
|
+
{ at: 17, cx: 130, cy: 450, tf: `rotate(${-30 + sway(4, 24)} 130 450)`, node: <g><path d="M130 330 L175 430 L130 470 L85 430 Z" fill="#9AA3A8" /><rect x={122} y={470} width={16} height={90} fill={P.red} /></g> },
|
|
53
|
+
] };
|
|
54
|
+
case "pot":
|
|
55
|
+
return { list: [
|
|
56
|
+
...[0, 1, 2].map((i) => ({ at: 12 + i * 2, cx: 220 + i * 80, cy: 150, tf: `translate(0 ${-((t * 3 + i * 25) % 70)})`,
|
|
57
|
+
node: <path d={`M${220 + i * 80} 250 q -30 -40 0 -80 q 30 -40 0 -80`} stroke={W} strokeWidth={22} fill="none" strokeLinecap="round" /> })),
|
|
58
|
+
{ at: 2, cx: 300, cy: 400, node: <path d="M140 300 L460 300 L440 470 Q300 520 160 470 Z" fill={P.red} /> },
|
|
59
|
+
{ at: 4, cx: 300, cy: 290, node: <rect x={110} y={270} width={380} height={42} fill={P.ink} /> },
|
|
60
|
+
{ at: 6, cx: 300, cy: 360, node: <g><rect x={80} y={330} width={70} height={30} fill={P.ink} /><rect x={450} y={330} width={70} height={30} fill={P.ink} /></g> },
|
|
61
|
+
...[[110, 120], [480, 140], [420, 60], [170, 50]].map(([x, y], i) => ({ at: 16 + i * 3, cx: x, cy: y,
|
|
62
|
+
tf: `rotate(${t * 4} ${x} ${y}) scale(1)`, node: <path d={star(x, y, 4, 45 * (0.7 + 0.5 * pulse), 12)} fill={P.yellow} /> })),
|
|
63
|
+
] };
|
|
64
|
+
case "wheel":
|
|
65
|
+
return { list: [
|
|
66
|
+
...[0, 1, 2].map((i) => ({ at: 2 + i, cx: 120, cy: 220 + i * 80, node: <rect x={20 + i * 30} y={200 + i * 80} width={200} height={26} fill={i === 1 ? P.yellow : P.red} /> })),
|
|
67
|
+
{ at: 5, cx: 330, cy: 300, tf: `rotate(${t * 9} 330 300)`, node: <g>
|
|
68
|
+
<circle cx={330} cy={300} r={200} fill={P.ink} /><circle cx={330} cy={300} r={140} fill={P.yellow} />
|
|
69
|
+
{Array.from({ length: 6 }).map((_, i) => <rect key={i} x={322} y={170} width={16} height={260} fill={P.ink} transform={`rotate(${i * 30} 330 300)`} />)}
|
|
70
|
+
<circle cx={330} cy={300} r={40} fill={P.red} /></g> },
|
|
71
|
+
{ at: 9, cx: 300, cy: 530, node: <path d="M20 520 L580 510 L585 545 L15 555 Z" fill={P.ink} /> },
|
|
72
|
+
] };
|
|
73
|
+
case "bowling": {
|
|
74
|
+
// ball rolls in from the left and scatters the pins
|
|
75
|
+
const roll = Math.min(1, Math.max(0, (t - 8) / 70)); // strike lands on "roll" (~f94 of the clip)
|
|
76
|
+
const hit = Math.min(1, Math.max(0, (t - 78) / 10));
|
|
77
|
+
const bx = -60 + roll * 250;
|
|
78
|
+
const pin = (x: number, y: number) => (
|
|
79
|
+
<g><path d={`M${x} ${y - 95} C${x + 26} ${y - 95} ${x + 26} ${y - 55} ${x + 14} ${y - 40} C${x + 40} ${y - 10} ${x + 40} ${y + 50} ${x + 22} ${y + 70} L${x - 22} ${y + 70} C${x - 40} ${y + 50} ${x - 40} ${y - 10} ${x - 14} ${y - 40} C${x - 26} ${y - 55} ${x - 26} ${y - 95} ${x} ${y - 95} Z`} fill={W} />
|
|
80
|
+
<rect x={x - 17} y={y - 42} width={34} height={10} fill={P.red} /><rect x={x - 19} y={y - 26} width={38} height={10} fill={P.red} /></g>
|
|
81
|
+
);
|
|
82
|
+
const pins: [number, number][] = [[350, 300], [420, 270], [420, 340], [490, 240], [490, 310], [490, 380]];
|
|
83
|
+
return { list: [
|
|
84
|
+
{ at: 2, cx: 300, cy: 520, node: <path d="M0 470 L600 455 L600 560 L0 575 Z" fill={P.kraft} /> },
|
|
85
|
+
...pins.map(([x, y], i) => {
|
|
86
|
+
const a = hash(seed + i, 21) * 2 - 1;
|
|
87
|
+
return { at: 4 + i, cx: x, cy: y, tf: `translate(${hit * (30 + i * 12)} ${-Math.sin(hit * Math.PI) * 70 + hit * 40}) rotate(${hit * (a > 0 ? 75 : -75)} ${x} ${y + 70})`, node: pin(x, y) };
|
|
88
|
+
}),
|
|
89
|
+
{ at: 3, cx: 220, cy: 380, tf: `translate(${bx - 220} 0) rotate(${roll * 540} 220 380)`, node: <g>
|
|
90
|
+
<circle cx={220} cy={380} r={110} fill={P.ink} />
|
|
91
|
+
<circle cx={190} cy={340} r={16} fill={P.paper} /><circle cx={232} cy={330} r={16} fill={P.paper} /><circle cx={215} cy={375} r={16} fill={P.paper} /></g> },
|
|
92
|
+
...(hit > 0 && t < 100 ? [{ at: 16, cx: 450, cy: 300, node: <path d={star(400, 300, 12, 230 * Math.min(1, hit * 1.5), 90)} fill={P.yellow} /> }] : []),
|
|
93
|
+
] };
|
|
94
|
+
}
|
|
95
|
+
case "cheer":
|
|
96
|
+
return { list: [
|
|
97
|
+
{ at: 2, cx: 300, cy: 300, tf: `rotate(${t * 0.8} 300 300) scale(${1 + pulse * 0.05})`, node: <path d={star(300, 300, 14, 280, 190)} fill={P.yellow} /> },
|
|
98
|
+
{ at: 5, cx: 300, cy: 300, tf: `rotate(${-t * 1.2} 300 300)`, node: <path d={star(300, 300, 12, 190, 130)} fill={P.red} /> },
|
|
99
|
+
...[-1, 0, 1].map((i) => ({ at: 9 + (i + 1) * 3, cx: 300 + i * 90, cy: 300, tf: `rotate(${i * 12} ${300 + i * 90} 300)`,
|
|
100
|
+
node: <g><rect x={278 + i * 90} y={180} width={44} height={150} fill={P.ink} /><rect x={278 + i * 90} y={350} width={44} height={44} fill={P.ink} /></g> })),
|
|
101
|
+
...Array.from({ length: 12 }).map((_, i) => {
|
|
102
|
+
const x = 30 + hash(seed + i, 1) * 540, y0 = hash(seed + i, 2) * 300;
|
|
103
|
+
const y = (y0 + t * (4 + hash(seed + i, 3) * 4)) % 620 - 20;
|
|
104
|
+
return { at: 12, cx: x, cy: y, node: <rect x={x} y={y} width={26} height={14} transform={`rotate(${t * 10 + i * 40} ${x} ${y})`} fill={[P.pink, P.teal, P.blue, P.orange][i % 4]} /> };
|
|
105
|
+
}),
|
|
106
|
+
] };
|
|
107
|
+
case "sun":
|
|
108
|
+
return { list: [
|
|
109
|
+
{ at: 2, cx: 300, cy: 300, tf: `rotate(${t * 1.5} 300 300)`, node: <g>{Array.from({ length: 12 }).map((_, i) => <path key={i} d="M300 10 L335 120 L265 120 Z" fill={P.orange} transform={`rotate(${i * 30} 300 300)`} />)}</g> },
|
|
110
|
+
{ at: 5, cx: 300, cy: 300, tf: `scale(${1 + pulse * 0.04})`, node: <circle cx={300} cy={300} r={160} fill={P.yellow} /> },
|
|
111
|
+
{ at: 8, cx: 300, cy: 300, node: <circle cx={300} cy={300} r={105} fill="none" stroke={P.orange} strokeWidth={18} strokeDasharray="40 22" /> },
|
|
112
|
+
] };
|
|
113
|
+
case "dumbbell": {
|
|
114
|
+
const lift = -Math.abs(Math.sin((t / 22) * Math.PI)) * 60;
|
|
115
|
+
return { list: [
|
|
116
|
+
{ at: 2, cx: 300, cy: 300, tf: `scale(${1 + pulse * 0.06})`, node: <path d={heart(300, 330, 230)} fill={P.pink} /> },
|
|
117
|
+
{ at: 6, cx: 300, cy: 300, tf: `translate(0 ${lift}) rotate(${sway(4, 22)} 300 300)`, node: <g>
|
|
118
|
+
<rect x={100} y={285} width={400} height={30} fill={P.ink} />
|
|
119
|
+
<rect x={80} y={190} width={60} height={220} fill={P.red} /><rect x={140} y={220} width={36} height={160} fill={P.yellow} />
|
|
120
|
+
<rect x={460} y={190} width={60} height={220} fill={P.red} /><rect x={424} y={220} width={36} height={160} fill={P.yellow} /></g> },
|
|
121
|
+
] };
|
|
122
|
+
}
|
|
123
|
+
case "calendar":
|
|
124
|
+
return { list: [
|
|
125
|
+
{ at: 2, cx: 300, cy: 320, node: <g><rect x={140} y={130} width={330} height={400} fill="#D8D0C0" /><rect x={125} y={115} width={340} height={405} fill={W} /></g> },
|
|
126
|
+
{ at: 4, cx: 300, cy: 160, node: <rect x={125} y={115} width={340} height={95} fill={P.red} /> },
|
|
127
|
+
{ at: 6, cx: 300, cy: 115, node: <g>{[190, 300, 410].map((x) => <rect key={x} x={x - 9} y={85} width={18} height={60} rx={9} fill={P.ink} />)}</g> },
|
|
128
|
+
// a page tearing off every step
|
|
129
|
+
{ at: 6, cx: 300, cy: 360, tf: `translate(${(t % 5) * 40} ${-(t % 5) * 50}) rotate(${(t % 5) * 14} 300 360)`, node: <rect x={125} y={210} width={340} height={310} fill="#FFF6E0" opacity={0.9} /> },
|
|
130
|
+
], html: { calendar: true } as any };
|
|
131
|
+
case "medal":
|
|
132
|
+
return { list: [
|
|
133
|
+
{ at: 2, cx: 300, cy: 100, node: <g><path d="M190 0 L280 0 L330 250 L250 250 Z" fill={P.blue} /><path d="M410 0 L320 0 L270 250 L350 250 Z" fill={P.red} /></g> },
|
|
134
|
+
{ at: 5, cx: 300, cy: 360, tf: `rotate(${sway(8, 26)} 300 0)`, node: <g>
|
|
135
|
+
<path d={star(300, 370, 16, 175, 150)} fill={P.yellow} /><circle cx={300} cy={370} r={120} fill={P.orange} />
|
|
136
|
+
<path d={star(300, 370, 5, 85, 36)} fill={P.ink} /></g> },
|
|
137
|
+
] };
|
|
138
|
+
case "house":
|
|
139
|
+
return { list: [
|
|
140
|
+
{ at: 2, cx: 300, cy: 540, node: <path d="M0 520 L600 510 L600 600 L0 600 Z" fill={P.green} /> },
|
|
141
|
+
...[0, 1, 2].map((i) => ({ at: 12 + i * 2, cx: 400, cy: 120, tf: `translate(${(t * 2 + i * 30) % 60} ${-((t * 4 + i * 45) % 130)})`, node: <circle cx={410} cy={130} r={24 + i * 6} fill={W} /> })),
|
|
142
|
+
{ at: 4, cx: 410, cy: 190, node: <rect x={385} y={130} width={50} height={110} fill={P.ink} /> },
|
|
143
|
+
{ at: 5, cx: 300, cy: 400, node: <rect x={150} y={290} width={300} height={240} fill={P.kraft} /> },
|
|
144
|
+
{ at: 7, cx: 300, cy: 220, node: <path d="M110 300 L300 120 L490 300 Z" fill={P.red} /> },
|
|
145
|
+
{ at: 9, cx: 300, cy: 460, node: <g><rect x={265} y={400} width={70} height={130} fill={P.ink} /><rect x={180} y={340} width={60} height={60} fill={P.yellow} /><rect x={360} y={340} width={60} height={60} fill={P.yellow} /></g> },
|
|
146
|
+
{ at: 11, cx: 100, cy: 200, tf: `translate(0 ${-Math.abs(Math.sin(t / 6)) * 30}) rotate(${sway(15, 12)} 100 200)`, node: note(80, 230, P.ink) },
|
|
147
|
+
{ at: 13, cx: 520, cy: 260, tf: `translate(0 ${-Math.abs(Math.cos(t / 6)) * 30}) rotate(${sway(-15, 12)} 520 260)`, node: note(500, 300, P.pink) },
|
|
148
|
+
] };
|
|
149
|
+
case "palm":
|
|
150
|
+
return { list: [
|
|
151
|
+
{ at: 2, cx: 400, cy: 220, tf: `scale(${1 + pulse * 0.04})`, node: <circle cx={410} cy={230} r={140} fill={P.orange} /> },
|
|
152
|
+
{ at: 4, cx: 300, cy: 540, node: <path d="M0 500 Q75 470 150 500 T300 500 T450 500 T600 500 L600 600 L0 600 Z" fill={P.teal} transform={`translate(${-(t * 3) % 150} 0)`} /> },
|
|
153
|
+
{ at: 6, cx: 290, cy: 400, node: <g>{Array.from({ length: 7 }).map((_, i) => <path key={i} d={`M${282 - i * 6} ${540 - i * 45} L${318 - i * 6} ${540 - i * 45} L${312 - (i + 1) * 6} ${495 - i * 45} L${288 - (i + 1) * 6} ${495 - i * 45} Z`} fill={i % 2 ? P.kraft : "#A87B4F"} />)}</g> },
|
|
154
|
+
...Array.from({ length: 6 }).map((_, i) => ({ at: 9 + i, cx: 255, cy: 225, tf: `rotate(${sway(5, 34, i * 6)} 255 225)`,
|
|
155
|
+
node: <path d={leaf(200, 38)} transform={`translate(255 225) rotate(${-170 + i * 36 + (i > 2 ? 20 : 0)})`} fill={i % 2 ? P.green : "#2E7D32"} /> })),
|
|
156
|
+
{ at: 15, cx: 255, cy: 240, node: <g><circle cx={240} cy={245} r={18} fill={P.ink} /><circle cx={272} cy={250} r={18} fill={P.ink} /></g> },
|
|
157
|
+
] };
|
|
158
|
+
case "glasses": {
|
|
159
|
+
const clink = Math.min(1, Math.max(0, (t - 10) / 8));
|
|
160
|
+
const g = (x: number, rot: number, c: string) => (
|
|
161
|
+
<g transform={`rotate(${rot} ${x} 300)`}>
|
|
162
|
+
<path d={`M${x - 110} 160 L${x + 110} 160 Q${x + 100} 300 ${x} 310 Q${x - 100} 300 ${x - 110} 160 Z`} fill={c} />
|
|
163
|
+
<rect x={x - 10} y={305} width={20} height={160} fill={W} /><path d={`M${x - 80} 480 L${x + 80} 480 L${x + 60} 460 L${x - 60} 460 Z`} fill={W} />
|
|
164
|
+
</g>
|
|
165
|
+
);
|
|
166
|
+
return { list: [
|
|
167
|
+
{ at: 2, cx: 170, cy: 300, tf: `translate(${clink * 60} 0)`, node: g(170, 14 - clink * 6, P.yellow) },
|
|
168
|
+
{ at: 4, cx: 430, cy: 300, tf: `translate(${-clink * 60} 0)`, node: g(430, -14 + clink * 6, P.orange) },
|
|
169
|
+
...(clink >= 1 ? [{ at: 18, cx: 300, cy: 150, tf: `rotate(${t * 3} 300 150)`, node: <path d={star(300, 140, 10, 110, 50)} fill={P.pink} /> }] : []),
|
|
170
|
+
...Array.from({ length: 8 }).map((_, i) => {
|
|
171
|
+
const x = 140 + hash(seed + i, 4) * 320, y = 240 - ((t * 5 + i * 37) % 240);
|
|
172
|
+
return { at: 8, cx: x, cy: y, node: <circle cx={x} cy={y} r={8 + (i % 3) * 5} fill={W} /> };
|
|
173
|
+
}),
|
|
174
|
+
] };
|
|
175
|
+
}
|
|
176
|
+
case "sprout":
|
|
177
|
+
return { list: [
|
|
178
|
+
...[[120, 140], [480, 120], [500, 380], [100, 400]].map(([x, y], i) => ({ at: 12 + i * 2, cx: x, cy: y, tf: `rotate(${t * 5} ${x} ${y})`, node: <path d={star(x, y, 4, 50 * (0.7 + 0.5 * pulse), 13)} fill={P.yellow} /> })),
|
|
179
|
+
{ at: 2, cx: 300, cy: 500, node: <path d="M190 430 L410 430 L380 580 L220 580 Z" fill={P.orange} /> },
|
|
180
|
+
{ at: 4, cx: 300, cy: 430, node: <rect x={170} y={410} width={260} height={40} fill={P.red} /> },
|
|
181
|
+
{ at: 6, cx: 300, cy: 420, tf: `scale(1 ${Math.min(1, 0.4 + t / 30)})`, node: <rect x={290} y={170} width={20} height={250} fill={P.green} /> },
|
|
182
|
+
{ at: 9, cx: 300, cy: 200, tf: `rotate(${sway(8, 26)} 300 200)`, node: <g><path d={leaf(190, 60)} transform="translate(300 200) rotate(-25)" fill={P.green} /><path d={leaf(170, 55)} transform="translate(300 230) rotate(-160)" fill="#2E7D32" /></g> },
|
|
183
|
+
] };
|
|
184
|
+
case "crown":
|
|
185
|
+
return { list: [
|
|
186
|
+
{ at: 2, cx: 300, cy: 300, tf: `rotate(${t} 300 300)`, node: <path d={star(300, 300, 18, 290, 230)} fill={P.pink} /> },
|
|
187
|
+
{ at: 5, cx: 300, cy: 300, tf: `translate(0 ${sway(10, 20)}) rotate(${sway(5, 30)} 300 300)`, node: <g>
|
|
188
|
+
<path d="M120 400 L100 170 L200 280 L300 130 L400 280 L500 170 L480 400 Z" fill={P.yellow} />
|
|
189
|
+
<rect x={115} y={380} width={370} height={60} fill={P.red} />
|
|
190
|
+
{[180, 300, 420].map((x, i) => <circle key={x} cx={x} cy={410} r={20} fill={[P.teal, P.blue, P.teal][i]} />)}
|
|
191
|
+
{[100, 300, 500].map((x, i) => <circle key={x} cx={x} cy={[165, 125, 165][i]} r={22} fill={P.pink} />)}</g> },
|
|
192
|
+
] };
|
|
193
|
+
case "maple":
|
|
194
|
+
return { list: [
|
|
195
|
+
{ at: 2, cx: 300, cy: 320, tf: `rotate(${sway(6, 30)} 300 520)`, node: <g>
|
|
196
|
+
<path d="M300 60 L335 160 L390 130 L375 240 L470 180 L450 250 L540 270 L470 330 L500 380 L380 370 L395 450 L310 410 L310 540 L290 540 L290 410 L205 450 L220 370 L100 380 L130 330 L60 270 L150 250 L130 180 L225 240 L210 130 L265 160 Z" fill={P.red} /></g> },
|
|
197
|
+
...Array.from({ length: 10 }).map((_, i) => {
|
|
198
|
+
const x = 30 + hash(seed + i, 7) * 540, y = ((hash(seed + i, 8) * 600 + t * 14) % 660) - 40;
|
|
199
|
+
return { at: 10, cx: x, cy: y, node: <path d={`M${x} ${y} q 18 30 0 44 q -18 -14 0 -44 Z`} fill={P.blue} /> };
|
|
200
|
+
}),
|
|
201
|
+
] };
|
|
202
|
+
case "hearts":
|
|
203
|
+
case "hearts2": {
|
|
204
|
+
const a = kind === "hearts" ? [P.red, P.pink] : [P.orange, P.teal];
|
|
205
|
+
const b1 = 1 + 0.08 * beatPulse(abs, 10), b2 = 1 + 0.08 * beatPulse(abs - 6, 10);
|
|
206
|
+
return { list: [
|
|
207
|
+
{ at: 2, cx: 230, cy: 290, tf: `rotate(-12 230 290) scale(${b1})`, node: <path d={heart(230, 290, 170)} fill={a[0]} /> },
|
|
208
|
+
{ at: 6, cx: 380, cy: 320, tf: `rotate(14 380 320) scale(${b2})`, node: <path d={heart(380, 320, 150)} fill={a[1]} /> },
|
|
209
|
+
{ at: 10, cx: 300, cy: 300, node: <path d="M120 470 L180 440 L240 480 L300 440 L360 480 L420 440 L480 470" stroke={P.ink} strokeWidth={12} fill="none" strokeDasharray="22 16" /> },
|
|
210
|
+
...[[90, 120], [520, 140], [500, 500]].map(([x, y], i) => ({ at: 12 + i * 2, cx: x, cy: y, tf: `rotate(${t * 4} ${x} ${y})`, node: <path d={star(x, y, 5, 36, 15)} fill={P.yellow} /> })),
|
|
211
|
+
] };
|
|
212
|
+
}
|
|
213
|
+
case "notes":
|
|
214
|
+
return { list: [
|
|
215
|
+
{ at: 2, cx: 460, cy: 130, node: <path d="M460 40 A100 100 0 1 0 540 200 A80 80 0 1 1 460 40 Z" fill={P.yellow} /> },
|
|
216
|
+
...[[140, 360, P.ink], [300, 300, P.red], [460, 400, P.teal]].map(([x, y, c], i) => ({ at: 5 + i * 3, cx: x as number, cy: y as number,
|
|
217
|
+
tf: `translate(0 ${-beatPulse(abs - i * 4, 10) * 40}) rotate(${sway(10, 18, i * 5)} ${x} ${y})`, node: note(x as number, y as number, c as string) })),
|
|
218
|
+
], html: { haha: true } as any };
|
|
219
|
+
case "bolt":
|
|
220
|
+
return { list: [
|
|
221
|
+
{ at: 2, cx: 300, cy: 300, tf: `scale(${1 + pulse * 0.06})`, node: <path d={star(300, 300, 9, 290, 180, 0.2)} fill={P.red} /> },
|
|
222
|
+
{ at: 5, cx: 300, cy: 300, tf: `rotate(${sway(4, 10)} 300 300)`, node: <path d="M350 40 L170 330 L290 330 L230 560 L440 250 L320 250 L400 40 Z" fill={P.yellow} /> },
|
|
223
|
+
] };
|
|
224
|
+
case "bolt2":
|
|
225
|
+
return { list: [
|
|
226
|
+
{ at: 2, cx: 300, cy: 300, node: <rect x={60} y={200} width={480} height={200} fill={P.ink} transform="rotate(-6 300 300)" /> },
|
|
227
|
+
{ at: 14, cx: 300, cy: 300, node: <g><rect x={40} y={285} width={520} height={34} fill={P.red} transform="rotate(25 300 300)" /><rect x={40} y={285} width={520} height={34} fill={P.red} transform="rotate(-25 300 300)" /></g> },
|
|
228
|
+
], html: { cant: true } as any };
|
|
229
|
+
case "food":
|
|
230
|
+
return { list: [
|
|
231
|
+
{ at: 2, cx: 300, cy: 520, node: <path d="M0 440 L600 430 L600 600 L0 600 Z" fill={P.kraft} /> },
|
|
232
|
+
{ at: 4, cx: 300, cy: 380, node: <g><ellipse cx={300} cy={390} rx={210} ry={120} fill={W} /><ellipse cx={300} cy={385} rx={150} ry={82} fill="#E9E1CF" /></g> },
|
|
233
|
+
{ at: 7, cx: 300, cy: 360, node: <path d="M220 400 L380 400 L320 300 Z" fill={P.orange} /> },
|
|
234
|
+
{ at: 9, cx: 300, cy: 380, node: <g><circle cx={240} cy={350} r={20} fill={P.green} /><circle cx={370} cy={360} r={18} fill={P.green} /><circle cx={350} cy={410} r={16} fill={P.red} /></g> },
|
|
235
|
+
{ at: 11, cx: 60, cy: 400, node: <g><rect x={40} y={260} width={20} height={250} fill="#9AA3A8" /><rect x={540} y={260} width={20} height={250} fill="#9AA3A8" /><rect x={530} y={250} width={40} height={80} fill="#9AA3A8" /></g> },
|
|
236
|
+
...[0, 1, 2].map((i) => ({ at: 13 + i, cx: 240 + i * 60, cy: 200, tf: `translate(0 ${-((t * 3 + i * 20) % 50)})`, node: <path d={`M${240 + i * 60} 270 q -20 -30 0 -60 q 20 -30 0 -60`} stroke={P.ink} strokeWidth={12} fill="none" strokeLinecap="round" /> })),
|
|
237
|
+
] };
|
|
238
|
+
case "camera": {
|
|
239
|
+
const flash = Math.max(0, 1 - Math.abs(t - 8) / 5);
|
|
240
|
+
return { list: [
|
|
241
|
+
{ at: 2, cx: 300, cy: 320, node: <g><rect x={90} y={200} width={420} height={260} rx={30} fill={P.ink} /><rect x={150} y={160} width={140} height={60} fill={P.ink} /><rect x={400} y={170} width={70} height={40} fill={P.yellow} /></g> },
|
|
242
|
+
{ at: 5, cx: 300, cy: 330, tf: `rotate(${t * 3} 300 330)`, node: <g><circle cx={300} cy={330} r={110} fill={W} /><circle cx={300} cy={330} r={82} fill={P.teal} /><circle cx={300} cy={330} r={38} fill={P.ink} /><rect x={270} y={262} width={24} height={24} fill={W} opacity={0.8} /></g> },
|
|
243
|
+
{ at: 7, cx: 135, cy: 245, node: <circle cx={135} cy={245} r={16} fill={P.red} opacity={Math.floor(t / 8) % 2 ? 1 : 0.25} /> },
|
|
244
|
+
...(flash > 0 ? [{ at: 6, cx: 435, cy: 140, node: <path d={star(435, 150, 12, 150 * flash, 50 * flash)} fill={P.yellow} /> }] : []),
|
|
245
|
+
] };
|
|
246
|
+
}
|
|
247
|
+
case "vinyl":
|
|
248
|
+
return { list: [
|
|
249
|
+
{ at: 2, cx: 300, cy: 300, tf: `rotate(${t * 6} 300 300)`, node: <g>
|
|
250
|
+
<circle cx={300} cy={300} r={240} fill={P.ink} />
|
|
251
|
+
{[200, 170, 140].map((r) => <circle key={r} cx={300} cy={300} r={r} fill="none" stroke="#3a3836" strokeWidth={4} />)}
|
|
252
|
+
<circle cx={300} cy={300} r={85} fill={P.red} /><rect x={240} y={270} width={70} height={16} fill={P.yellow} /><circle cx={300} cy={300} r={10} fill={P.paper} /></g> },
|
|
253
|
+
{ at: 8, cx: 500, cy: 120, tf: `rotate(${sway(8, 16)} 500 120)`, node: note(470, 160, P.pink) },
|
|
254
|
+
] };
|
|
255
|
+
case "clock":
|
|
256
|
+
return { list: [
|
|
257
|
+
{ at: 2, cx: 300, cy: 300, node: <g><circle cx={300} cy={300} r={230} fill={P.ink} /><circle cx={300} cy={300} r={200} fill={W} />
|
|
258
|
+
{Array.from({ length: 12 }).map((_, i) => <rect key={i} x={294} y={110} width={12} height={i % 3 ? 22 : 40} fill={P.ink} transform={`rotate(${i * 30} 300 300)`} />)}</g> },
|
|
259
|
+
{ at: 6, cx: 300, cy: 300, tf: `rotate(${-t * 6} 300 300)`, node: <rect x={290} y={170} width={20} height={140} fill={P.red} /> },
|
|
260
|
+
{ at: 7, cx: 300, cy: 300, tf: `rotate(${-t * 30} 300 300)`, node: <rect x={295} y={120} width={10} height={190} fill={P.ink} /> },
|
|
261
|
+
{ at: 8, cx: 300, cy: 300, node: <circle cx={300} cy={300} r={18} fill={P.yellow} /> },
|
|
262
|
+
] };
|
|
263
|
+
case "badge53":
|
|
264
|
+
return { list: [
|
|
265
|
+
{ at: 2, cx: 300, cy: 300, tf: `rotate(${t * 1.2} 300 300) scale(${1 + pulse * 0.05})`, node: <path d={star(300, 300, 20, 290, 240)} fill={P.yellow} /> },
|
|
266
|
+
{ at: 4, cx: 300, cy: 300, node: <circle cx={300} cy={300} r={210} fill={P.red} /> },
|
|
267
|
+
{ at: 5, cx: 300, cy: 300, node: <circle cx={300} cy={300} r={185} fill="none" stroke={W} strokeWidth={8} strokeDasharray="18 12" /> },
|
|
268
|
+
], html: { big: "53", small: "YEARS YOUNG" } as any };
|
|
269
|
+
case "heartbeat": {
|
|
270
|
+
const draw = Math.min(1, t / 20);
|
|
271
|
+
return { list: [
|
|
272
|
+
{ at: 2, cx: 300, cy: 300, tf: `scale(${1 + pulse * 0.07})`, node: <path d={heart(300, 320, 240)} fill={P.red} /> },
|
|
273
|
+
{ at: 5, cx: 300, cy: 300, node: <path d="M20 310 L200 310 L240 200 L290 420 L340 150 L380 310 L580 310" stroke={W} strokeWidth={22} fill="none" strokeLinejoin="round" strokeDasharray="1200" strokeDashoffset={1200 * (1 - draw)} /> },
|
|
274
|
+
] };
|
|
275
|
+
}
|
|
276
|
+
case "cake": {
|
|
277
|
+
const flick = (i: number) => 1 + (hash(Math.floor(t / 2.5) + i * 9, 3) - 0.5) * 0.3;
|
|
278
|
+
return { list: [
|
|
279
|
+
{ at: 2, cx: 300, cy: 510, node: <rect x={80} y={470} width={440} height={90} fill={P.pink} /> },
|
|
280
|
+
{ at: 4, cx: 300, cy: 420, node: <rect x={120} y={380} width={360} height={95} fill={P.cream} /> },
|
|
281
|
+
{ at: 6, cx: 300, cy: 340, node: <g><rect x={160} y={300} width={280} height={85} fill={P.red} /><path d="M160 300 L440 300 L440 325 Q420 350 400 325 Q380 350 360 325 Q340 350 320 325 Q300 350 280 325 Q260 350 240 325 Q220 350 200 325 Q180 350 160 325 Z" fill={W} /></g> },
|
|
282
|
+
...[240, 360].map((x, i) => ({ at: 9 + i * 2, cx: x, cy: 120, tf: `scale(1 ${flick(i)})`, node: <g><path d={`M${x} 40 Q${x + 30} 90 ${x} 115 Q${x - 30} 90 ${x} 40 Z`} fill={P.orange} /><path d={`M${x} 70 Q${x + 14} 95 ${x} 110 Q${x - 14} 95 ${x} 70 Z`} fill={P.yellow} /></g> })),
|
|
283
|
+
], html: { candles: true } as any };
|
|
284
|
+
}
|
|
285
|
+
case "chain": {
|
|
286
|
+
const apart = Math.min(1, Math.max(0, (t - 8) / 10));
|
|
287
|
+
const link = (x: number, y: number, r: number, c: string) => <rect x={x - 60} y={y - 35} width={120} height={70} rx={35} fill="none" stroke={c} strokeWidth={22} transform={`rotate(${r} ${x} ${y})`} />;
|
|
288
|
+
return { list: [
|
|
289
|
+
{ at: 2, cx: 300, cy: 300, tf: `scale(${apart})`, node: <path d={star(300, 300, 12, 260, 120)} fill={P.yellow} /> },
|
|
290
|
+
{ at: 3, cx: 180, cy: 300, tf: `translate(${-apart * 90} ${apart * 30}) rotate(${-apart * 20} 180 300)`, node: <g>{link(60, 300, 0, P.ink)}{link(170, 300, 90, P.ink)}</g> },
|
|
291
|
+
{ at: 4, cx: 420, cy: 300, tf: `translate(${apart * 90} ${-apart * 30}) rotate(${apart * 20} 420 300)`, node: <g>{link(430, 300, 90, P.ink)}{link(540, 300, 0, P.ink)}</g> },
|
|
292
|
+
] };
|
|
293
|
+
}
|
|
294
|
+
default:
|
|
295
|
+
return { list: [{ at: 2, cx: 300, cy: 300, node: <path d={star(300, 300, 5, 240, 100)} fill={P.yellow} /> }] };
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export default function Motif(props: Props) {
|
|
300
|
+
const { kind = "sun", side = "right", seed = 1, width, height, clip } = props;
|
|
301
|
+
const mob = height > width && props.mobile ? props.mobile : {};
|
|
302
|
+
const x = mob.x ?? props.x, y = mob.y ?? props.y, scale = mob.scale ?? props.scale ?? 1;
|
|
303
|
+
const f = useCurrentFrame();
|
|
304
|
+
const abs = clip.from + f;
|
|
305
|
+
const D = clip.duration;
|
|
306
|
+
const pic = areas(width, height, side).pic;
|
|
307
|
+
const S = pic.size * scale * 0.92;
|
|
308
|
+
const cx = x != null ? x * width : pic.cx + (props.ox ?? 0) * pic.size;
|
|
309
|
+
const cy = y != null ? y * height : pic.cy + (props.oy ?? 0) * pic.size;
|
|
310
|
+
const { list, html } = pieces(kind, f, abs, seed);
|
|
311
|
+
const out = st(f, D - 9, 8, easeIn);
|
|
312
|
+
const dir = hash(seed, 2) > 0.5 ? 1 : -1;
|
|
313
|
+
const j = jit(seed, f, 2.5);
|
|
314
|
+
const fid = `cut-${clip.id}`;
|
|
315
|
+
const h: any = html ?? {};
|
|
316
|
+
const tq = q12(f);
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<AbsoluteFill>
|
|
320
|
+
<div style={{
|
|
321
|
+
position: "absolute", left: cx - S / 2, top: cy - S / 2, width: S, height: S, opacity: 1 - out,
|
|
322
|
+
transform: `translate(${j.x + out * dir * 300}px, ${j.y + out * 400}px) rotate(${j.r + out * dir * 40}deg)`,
|
|
323
|
+
}}>
|
|
324
|
+
<svg viewBox="0 0 600 600" width={S} height={S} style={{ overflow: "visible", position: "absolute", left: 0, top: 0 }}>
|
|
325
|
+
<defs>
|
|
326
|
+
<filter id={fid} x="-25%" y="-25%" width="150%" height="150%">
|
|
327
|
+
<feTurbulence type="fractalNoise" baseFrequency="0.035" numOctaves={2} seed={seed} result="n" />
|
|
328
|
+
<feDisplacementMap in="SourceGraphic" in2="n" scale={9} xChannelSelector="R" yChannelSelector="G" result="rough" />
|
|
329
|
+
<feOffset in="rough" dx={8} dy={11} result="off" />
|
|
330
|
+
<feFlood floodColor="#140c04" floodOpacity={0.42} />
|
|
331
|
+
<feComposite in2="off" operator="in" result="sh" />
|
|
332
|
+
<feMerge><feMergeNode in="sh" /><feMergeNode in="rough" /></feMerge>
|
|
333
|
+
</filter>
|
|
334
|
+
</defs>
|
|
335
|
+
{list.map((p, i) => {
|
|
336
|
+
const s = slap(f, p.at, 1.7);
|
|
337
|
+
if (s.o === 0) return null;
|
|
338
|
+
const r = (hash(seed + i, 11) - 0.5) * 6;
|
|
339
|
+
return (
|
|
340
|
+
<g key={i} filter={`url(#${fid})`}>
|
|
341
|
+
<g transform={`translate(${p.cx} ${p.cy}) scale(${s.s}) rotate(${r}) translate(${-p.cx} ${-p.cy})`}>
|
|
342
|
+
<g transform={p.tf ?? ""}>{p.node}</g>
|
|
343
|
+
</g>
|
|
344
|
+
</g>
|
|
345
|
+
);
|
|
346
|
+
})}
|
|
347
|
+
</svg>
|
|
348
|
+
{/* paper text pieces drawn in HTML so they get the project fonts */}
|
|
349
|
+
{h.big ? (
|
|
350
|
+
<div style={{ position: "absolute", inset: 0, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", opacity: slap(f, 7).o, transform: `scale(${slap(f, 7, 2).s}) rotate(-6deg)` }}>
|
|
351
|
+
<div style={{ fontFamily: "Anton", fontSize: S * 0.42, lineHeight: 0.9, color: P.white, textShadow: `${S * 0.012}px ${S * 0.016}px 0 ${P.ink}` }}>{h.big}</div>
|
|
352
|
+
<div style={{ fontFamily: "Rubik Mono One", fontSize: S * 0.05, color: P.yellow, marginTop: S * 0.02 }}>{h.small}</div>
|
|
353
|
+
</div>
|
|
354
|
+
) : null}
|
|
355
|
+
{h.calendar ? (
|
|
356
|
+
<div style={{ position: "absolute", left: S * (125 / 600), top: S * (210 / 600), width: S * (340 / 600), height: S * (310 / 600), display: "flex", alignItems: "center", justifyContent: "center", fontFamily: "Anton", fontSize: S * 0.32, color: P.ink, opacity: slap(f, 6).o }}>
|
|
357
|
+
{Math.min(53, 1 + Math.floor(Math.max(0, tq - 6) * 1.6))}
|
|
358
|
+
</div>
|
|
359
|
+
) : null}
|
|
360
|
+
{h.haha ? (["HA!", "HA!", "HA!"]).map((w, i) => {
|
|
361
|
+
const s2 = slap(f, 10 + i * 5, 2);
|
|
362
|
+
return <div key={i} style={{ position: "absolute", left: S * (0.05 + i * 0.3), top: S * (0.72 - (i % 2) * 0.1), opacity: s2.o, transform: `scale(${s2.s}) rotate(${(i - 1) * 12}deg)`, background: [P.pink, P.yellow, P.white][i], padding: `0 ${S * 0.02}px`, fontFamily: ["Anton", "Permanent Marker", "Abril Fatface"][i], fontSize: S * 0.11, color: P.ink, boxShadow: `6px 8px 0 rgba(20,12,4,0.4)` }}>{w}</div>;
|
|
363
|
+
}) : null}
|
|
364
|
+
{h.cant ? (
|
|
365
|
+
<div style={{ position: "absolute", inset: 0, display: "flex", alignItems: "center", justifyContent: "center", opacity: slap(f, 5).o, transform: `rotate(-6deg) scale(${slap(f, 5, 1.8).s})` }}>
|
|
366
|
+
<div style={{ fontFamily: "Anton", fontSize: S * 0.2, color: P.white, letterSpacing: "0.02em" }}>CAN'T</div>
|
|
367
|
+
</div>
|
|
368
|
+
) : null}
|
|
369
|
+
{h.candles ? [["5", P.yellow, 240], ["3", P.teal, 360]].map(([n, c, xx], i) => {
|
|
370
|
+
const s2 = slap(f, 8 + i * 2, 1.8);
|
|
371
|
+
return <div key={i} style={{ position: "absolute", left: S * ((xx as number) - 55) / 600, top: S * 0.19, width: S * 110 / 600, height: S * 0.31, display: "flex", alignItems: "center", justifyContent: "center", background: c as string, opacity: s2.o, transform: `scale(${s2.s})`, fontFamily: "Anton", fontSize: S * 0.2, color: P.ink, boxShadow: `6px 9px 0 rgba(20,12,4,0.4)` }}>{n}</div>;
|
|
372
|
+
}) : null}
|
|
373
|
+
</div>
|
|
374
|
+
</AbsoluteFill>
|
|
375
|
+
);
|
|
376
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// A photo as a torn, taped cut-out that gets slapped onto the wall. Treatments: color, xerox, red, pink, yellow.
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AbsoluteFill, Img, useCurrentFrame } from "remotion";
|
|
4
|
+
import { asset, type SceneProps } from "agentcut";
|
|
5
|
+
import { P, Paper, Tape, Halftone, areas, backOut, easeIn, jit, lerp, st, type Side } from "./lib/punk";
|
|
6
|
+
|
|
7
|
+
type Props = SceneProps & {
|
|
8
|
+
src?: string;
|
|
9
|
+
imgAspect?: number; // natural width / height of the image
|
|
10
|
+
side?: Side;
|
|
11
|
+
treatment?: "color" | "xerox" | "red" | "pink" | "yellow" | "teal";
|
|
12
|
+
aspect?: number; // frame width / height
|
|
13
|
+
zoom?: number; // 1 = whole photo
|
|
14
|
+
fx?: number; // focus point in the photo (0..1)
|
|
15
|
+
fy?: number;
|
|
16
|
+
rot?: number;
|
|
17
|
+
scale?: number; // size multiplier of the picture area
|
|
18
|
+
from?: "left" | "right" | "top" | "bottom";
|
|
19
|
+
seed?: number;
|
|
20
|
+
x?: number; // optional center override (fraction of width)
|
|
21
|
+
y?: number; // optional center override (fraction of height)
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const TINT: Record<string, string> = { red: P.red, pink: P.pink, yellow: P.yellow, teal: P.teal };
|
|
25
|
+
|
|
26
|
+
export default function Photo({ src = "assets/photo.jpg", imgAspect = 0.75, side = "right", treatment = "color", aspect = 0.78, zoom = 1, fx = 0.52, fy = 0.4, rot = -4, scale = 1, from = "bottom", seed = 3, x, y, width, height, clip }: Props) {
|
|
27
|
+
const f = useCurrentFrame();
|
|
28
|
+
const D = clip.duration;
|
|
29
|
+
const vertical = height > width;
|
|
30
|
+
const pic = areas(width, height, side).pic;
|
|
31
|
+
const cx = x != null ? x * width : pic.cx;
|
|
32
|
+
const cy = y != null ? y * height : pic.cy;
|
|
33
|
+
const S = pic.size * scale;
|
|
34
|
+
const h = aspect >= 1 ? (S * 1.15) / aspect : S;
|
|
35
|
+
const w = aspect >= 1 ? S * 1.15 : S * aspect;
|
|
36
|
+
const rim = Math.max(14, S * 0.035);
|
|
37
|
+
const iw = w - rim * 2, ih = h - rim * 2;
|
|
38
|
+
|
|
39
|
+
// photo cover + zoom around the focus point
|
|
40
|
+
const drift = lerp(1, 1.06, f / Math.max(1, D));
|
|
41
|
+
const imgW = Math.max(iw, ih * imgAspect) * zoom * drift;
|
|
42
|
+
const imgH = imgW / imgAspect;
|
|
43
|
+
const left = Math.min(0, Math.max(iw - imgW, iw / 2 - fx * imgW));
|
|
44
|
+
const top = Math.min(0, Math.max(ih - imgH, ih / 2 - fy * imgH));
|
|
45
|
+
|
|
46
|
+
const inT = st(f, 0, 10, backOut);
|
|
47
|
+
const outT = st(f, D - 9, 8, easeIn);
|
|
48
|
+
const off = vertical ? height : width;
|
|
49
|
+
const dir = { left: [-1, 0], right: [1, 0], top: [0, -1], bottom: [0, 1] }[from];
|
|
50
|
+
const dx = dir[0] * off * (1 - inT) - dir[0] * off * outT * 0.8 + (from === "left" || from === "right" ? 0 : 0);
|
|
51
|
+
const dy = dir[1] * off * (1 - inT) + off * outT * 0.9;
|
|
52
|
+
const j = jit(seed, f, 2);
|
|
53
|
+
const r = rot + (1 - inT) * 25 * (dir[0] || 1) + outT * 30 + j.r;
|
|
54
|
+
|
|
55
|
+
const filter = treatment === "color" ? "saturate(1.25) contrast(1.1)" : "grayscale(1) contrast(1.9) brightness(1.1)";
|
|
56
|
+
const tint = TINT[treatment];
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<AbsoluteFill>
|
|
60
|
+
<div style={{ position: "absolute", left: cx - w / 2 + dx + j.x, top: cy - h / 2 + dy + j.y, width: w, height: h, transform: `rotate(${r}deg)` }}>
|
|
61
|
+
<Paper w={w} h={h} seed={seed} tex="white" kind="tear" shadow={1.4}>
|
|
62
|
+
<div style={{ position: "absolute", left: rim, top: rim, width: iw, height: ih, overflow: "hidden", background: P.ink }}>
|
|
63
|
+
<Img src={asset(src)} style={{ position: "absolute", left, top, width: imgW, height: imgH, filter }} />
|
|
64
|
+
{tint ? <div style={{ position: "absolute", inset: 0, background: tint, opacity: 0.42 }} /> : null}
|
|
65
|
+
{treatment !== "color" ? <Halftone x={iw * 0.8} y={ih * 0.85} size={Math.max(iw, ih) * 0.9} color="black" o={0.35} /> : null}
|
|
66
|
+
</div>
|
|
67
|
+
</Paper>
|
|
68
|
+
<Tape x={w * 0.5} y={4} w={Math.min(220, w * 0.4)} rot={-3 + (seed % 5)} seed={seed} />
|
|
69
|
+
<Tape x={w * 0.92} y={h * 0.96} w={Math.min(170, w * 0.32)} rot={-38} seed={seed + 1} />
|
|
70
|
+
</div>
|
|
71
|
+
</AbsoluteFill>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// One sung line as a ransom note: each word is a cut-out paper chip that slaps down on its sung frame.
|
|
2
|
+
// Words starting with "*" are accents: cut letter by letter, bigger. Props: words [{t, at}] (frames from clip start).
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { AbsoluteFill, useCurrentFrame } from "remotion";
|
|
5
|
+
import type { SceneProps } from "agentcut";
|
|
6
|
+
import { CHIPS, FACES, P, areas, easeIn, hash, jit, outline, slap, st, strSeed, type Side } from "./lib/punk";
|
|
7
|
+
import { Img } from "remotion";
|
|
8
|
+
import { asset } from "agentcut";
|
|
9
|
+
|
|
10
|
+
type Word = { t: string; at: number };
|
|
11
|
+
type Props = SceneProps & {
|
|
12
|
+
words: Word[];
|
|
13
|
+
side?: Side;
|
|
14
|
+
seed?: number;
|
|
15
|
+
size?: number; // max font size px (wide); mobile scales
|
|
16
|
+
letters?: boolean; // cut every word letter by letter
|
|
17
|
+
stagger?: number; // frames between letters of an accent word
|
|
18
|
+
align?: "left" | "center" | "right";
|
|
19
|
+
yShift?: number; // fraction of height
|
|
20
|
+
palette?: number[]; // indexes into CHIPS to use
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function Chip({ text, size, face, chip, seed, rot, f, t0, exitT, exitDir }: {
|
|
24
|
+
text: string; size: number; face: (typeof FACES)[number]; chip: (typeof CHIPS)[number]; seed: number; rot: number;
|
|
25
|
+
f: number; t0: number; exitT: number; exitDir: number;
|
|
26
|
+
}) {
|
|
27
|
+
const [family, mult, upper] = face;
|
|
28
|
+
const [bg, fg, tex] = chip;
|
|
29
|
+
const fs = size * mult;
|
|
30
|
+
const s = slap(f, t0, 1.9);
|
|
31
|
+
const j = f >= t0 + 8 ? jit(seed, f, 1.6) : { x: 0, y: 0, r: 0 };
|
|
32
|
+
const e = exitT;
|
|
33
|
+
const estW = text.length * fs * 0.6 + fs * 0.5;
|
|
34
|
+
const estH = fs * 1.4;
|
|
35
|
+
const clip = outline(estW, estH, seed, hash(seed, 9) > 0.5 ? "tear" : "cut");
|
|
36
|
+
return (
|
|
37
|
+
<div style={{
|
|
38
|
+
position: "relative", display: "inline-block", margin: `${size * 0.05}px ${size * 0.11}px`,
|
|
39
|
+
opacity: s.o * (1 - e),
|
|
40
|
+
transform: `translate(${j.x + e * exitDir * 260}px, ${j.y - e * 380}px) rotate(${rot + j.r + e * exitDir * 70}deg) scale(${s.s})`,
|
|
41
|
+
}}>
|
|
42
|
+
<div style={{ position: "absolute", left: 7, top: 11, right: -7, bottom: -11, background: "rgba(20,12,4,0.45)", clipPath: clip }} />
|
|
43
|
+
<div style={{ position: "relative", background: bg, clipPath: clip, overflow: "hidden" }}>
|
|
44
|
+
{tex ? <Img src={asset(`assets/paper/${tex === "newsprint" ? "newsprint" : tex === "kraft" ? "kraft" : tex === "white" ? "paper-white" : "paper-cream"}.jpg`)}
|
|
45
|
+
style={{ position: "absolute", left: -((seed * 37) % 400), top: -((seed * 53) % 400), width: 1024, height: 1024 }} />
|
|
46
|
+
: <Img src={asset("assets/paper/grain-overlay.png")} style={{ position: "absolute", left: -((seed * 37) % 300), top: -((seed * 53) % 300), width: 1024, height: 1024, opacity: 0.4 }} />}
|
|
47
|
+
<div style={{
|
|
48
|
+
position: "relative", fontFamily: family, fontSize: fs, lineHeight: 1.08, color: fg, whiteSpace: "nowrap",
|
|
49
|
+
textTransform: upper ? "uppercase" : "none", padding: `${fs * 0.1}px ${fs * 0.2}px ${fs * 0.06}px`,
|
|
50
|
+
}}>{text}</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default function Ransom({ words = [], side = "left", seed = 1, size, letters = false, stagger = 2, align, yShift = 0, palette, width, height, clip }: Props) {
|
|
57
|
+
const f = useCurrentFrame();
|
|
58
|
+
const vertical = height > width;
|
|
59
|
+
const A = areas(width, height, side).text;
|
|
60
|
+
const base = seed * 101 + strSeed(words.map((w) => w.t).join(" "));
|
|
61
|
+
const chips = palette && palette.length ? palette.map((i) => CHIPS[i % CHIPS.length]) : CHIPS;
|
|
62
|
+
|
|
63
|
+
// fit the type to the area
|
|
64
|
+
const chars = words.reduce((n, w) => n + w.t.replace("*", "").length * (w.t.startsWith("*") ? 1.5 : 1), 0) + words.length * 0.8;
|
|
65
|
+
const maxSize = size ?? (vertical ? 120 : 118);
|
|
66
|
+
const fit = Math.sqrt((A.w * A.h * 0.85) / (Math.max(1, chars) * 0.62 * 1.5));
|
|
67
|
+
// the widest single word (accent words are cut letter by letter, ~1.3em per letter) must fit the area
|
|
68
|
+
const widest = Math.max(...words.map((w) => {
|
|
69
|
+
const n = w.t.replace("*", "").length;
|
|
70
|
+
return letters || w.t.startsWith("*") ? n * 1.34 + 0.3 : n * 0.66 + 0.6;
|
|
71
|
+
}), 1);
|
|
72
|
+
const fs = Math.max(40, Math.min(maxSize * (vertical ? 1.05 : 1), fit, (A.w * 0.94) / widest));
|
|
73
|
+
|
|
74
|
+
const D = clip.duration;
|
|
75
|
+
let k = 0;
|
|
76
|
+
const nodes = words.map((w, wi) => {
|
|
77
|
+
const accent = letters || w.t.startsWith("*");
|
|
78
|
+
const text = w.t.replace(/^\*/, "");
|
|
79
|
+
const ws = base + wi * 17;
|
|
80
|
+
const dir = hash(ws, 5) > 0.5 ? 1 : -1;
|
|
81
|
+
if (!accent) {
|
|
82
|
+
const face = FACES[Math.floor(hash(ws, 1) * FACES.length)];
|
|
83
|
+
const chip = chips[Math.floor(hash(ws, 2) * chips.length)];
|
|
84
|
+
const exitT = st(f, D - 10 + (k++) * 0.6, 7, easeIn);
|
|
85
|
+
return (
|
|
86
|
+
<Chip key={wi} text={text} size={fs} face={face} chip={chip} seed={ws} rot={(hash(ws, 3) - 0.5) * 9}
|
|
87
|
+
f={f} t0={w.at} exitT={exitT} exitDir={dir} />
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return (
|
|
91
|
+
<div key={wi} style={{ display: "inline-flex", alignItems: "center", margin: `0 ${fs * 0.12}px` }}>
|
|
92
|
+
{Array.from(text.toUpperCase()).map((ch, ci) => {
|
|
93
|
+
if (ch === " ") return <div key={ci} style={{ width: fs * 0.35 }} />;
|
|
94
|
+
const ls = ws + ci * 7;
|
|
95
|
+
const face = FACES[Math.floor(hash(ls, 1) * FACES.length)];
|
|
96
|
+
const chip = chips[Math.floor(hash(ls, 2) * chips.length)];
|
|
97
|
+
const exitT = st(f, D - 10 + (k++) * 0.4, 7, easeIn);
|
|
98
|
+
return (
|
|
99
|
+
<Chip key={ci} text={ch} size={fs * 1.2} face={face} chip={chip} seed={ls} rot={(hash(ls, 3) - 0.5) * 18}
|
|
100
|
+
f={f} t0={w.at + ci * stagger} exitT={exitT} exitDir={hash(ls, 5) > 0.5 ? 1 : -1} />
|
|
101
|
+
);
|
|
102
|
+
})}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
const justify = align ?? (vertical || side === "center" ? "center" : side === "left" ? "flex-start" : "flex-end");
|
|
108
|
+
return (
|
|
109
|
+
<AbsoluteFill>
|
|
110
|
+
<div style={{
|
|
111
|
+
position: "absolute", left: A.x, top: A.y + yShift * height, width: A.w, height: A.h,
|
|
112
|
+
display: "flex", flexWrap: "wrap", alignContent: "center", alignItems: "center", justifyContent: justify,
|
|
113
|
+
color: P.ink,
|
|
114
|
+
}}>
|
|
115
|
+
{nodes}
|
|
116
|
+
</div>
|
|
117
|
+
</AbsoluteFill>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Photocopy / tape-era overlay on top of everything: boiling grain, scratches, dark copier edges, flicker.
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { AbsoluteFill, Img, useCurrentFrame } from "remotion";
|
|
4
|
+
import { asset, type SceneProps } from "agentcut";
|
|
5
|
+
import { hash, beatPulse } from "./lib/punk";
|
|
6
|
+
|
|
7
|
+
type Props = SceneProps & { grain?: number; edges?: number; flash?: number };
|
|
8
|
+
|
|
9
|
+
export default function Xerox({ grain = 0.28, edges = 0.5, flash = 0.12, width, height, clip }: Props) {
|
|
10
|
+
const f = useCurrentFrame();
|
|
11
|
+
const abs = clip.from + f;
|
|
12
|
+
const k = Math.floor(f / 2);
|
|
13
|
+
const ox = -Math.floor(hash(k, 1) * 600), oy = -Math.floor(hash(k, 2) * 600);
|
|
14
|
+
const T = Math.max(width, height) + 700;
|
|
15
|
+
const scratch = hash(k, 3) > 0.6;
|
|
16
|
+
const flick = beatPulse(abs, 4) * flash;
|
|
17
|
+
return (
|
|
18
|
+
<AbsoluteFill style={{ pointerEvents: "none" }}>
|
|
19
|
+
<Img src={asset("assets/paper/grain-overlay.png")} style={{ position: "absolute", left: ox, top: oy, width: T, height: T, opacity: grain }} />
|
|
20
|
+
{scratch ? (
|
|
21
|
+
<div style={{ position: "absolute", left: hash(k, 4) * width, top: 0, width: 2 + hash(k, 5) * 2, height, background: "rgba(20,20,20,0.35)" }} />
|
|
22
|
+
) : null}
|
|
23
|
+
{hash(k, 6) > 0.8 ? (
|
|
24
|
+
<div style={{ position: "absolute", left: 0, top: hash(k, 7) * height, width, height: 3, background: "rgba(255,255,255,0.4)" }} />
|
|
25
|
+
) : null}
|
|
26
|
+
<div style={{ position: "absolute", inset: 0, background: `linear-gradient(90deg, rgba(10,8,6,${0.55 * edges}) 0%, rgba(10,8,6,0) 9%, rgba(10,8,6,0) 91%, rgba(10,8,6,${0.55 * edges}) 100%)` }} />
|
|
27
|
+
<div style={{ position: "absolute", inset: 0, background: `linear-gradient(180deg, rgba(10,8,6,${0.45 * edges}) 0%, rgba(10,8,6,0) 10%, rgba(10,8,6,0) 90%, rgba(10,8,6,${0.45 * edges}) 100%)` }} />
|
|
28
|
+
{flick > 0 ? <div style={{ position: "absolute", inset: 0, background: "#fff", opacity: flick }} /> : null}
|
|
29
|
+
</AbsoluteFill>
|
|
30
|
+
);
|
|
31
|
+
}
|