agentcut 0.0.0-stage → 0.1.0
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 +918 -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,437 @@
|
|
|
1
|
+
import { AbsoluteFill, Easing, random, useCurrentFrame } from "remotion";
|
|
2
|
+
import { FONTS, exitOut, ramp, splitHighlights } from "../lib";
|
|
3
|
+
import type { MotionBaseProps } from "../types";
|
|
4
|
+
|
|
5
|
+
type Props = MotionBaseProps & {
|
|
6
|
+
title: string[];
|
|
7
|
+
kicker: string;
|
|
8
|
+
layout: string;
|
|
9
|
+
red: string;
|
|
10
|
+
yellow: string;
|
|
11
|
+
blue: string;
|
|
12
|
+
ink: string;
|
|
13
|
+
paper: string;
|
|
14
|
+
bpm: number;
|
|
15
|
+
cols: number;
|
|
16
|
+
showGrid: boolean;
|
|
17
|
+
font: string;
|
|
18
|
+
seed: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type Kind = "square" | "circle" | "triangle" | "half" | "quarter";
|
|
22
|
+
type Hue = "red" | "yellow" | "blue" | "ink";
|
|
23
|
+
const HUES: Hue[] = ["red", "yellow", "blue", "ink"];
|
|
24
|
+
|
|
25
|
+
/** A shape's box on the grid, in modules (top-left x, y and size w × h), as it sits in the end frame. */
|
|
26
|
+
interface ShapeDef {
|
|
27
|
+
kind: Kind;
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
w: number;
|
|
31
|
+
h: number;
|
|
32
|
+
color: Hue;
|
|
33
|
+
/** Keeps turning 90° a beat after the hero moment, so the end frame stays alive. */
|
|
34
|
+
metronome?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Center (modules), angle (degrees) and color. */
|
|
38
|
+
interface State {
|
|
39
|
+
cx: number;
|
|
40
|
+
cy: number;
|
|
41
|
+
angle: number;
|
|
42
|
+
color: Hue;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type Action =
|
|
46
|
+
| { type: "move"; dx: number; dy: number }
|
|
47
|
+
| { type: "spin"; dir: number }
|
|
48
|
+
/** Turn about a fixed point: a corner of the shape's box (90°) or the frame center (180°). */
|
|
49
|
+
| { type: "pivot"; px: number; py: number; dir: number; deg: number }
|
|
50
|
+
| { type: "color"; from: Hue; to: Hue };
|
|
51
|
+
|
|
52
|
+
// The end-frame compositions, on a 6 × 6 module square.
|
|
53
|
+
const POSTER: ShapeDef[] = [
|
|
54
|
+
{ kind: "circle", x: 2, y: 0, w: 4, h: 4, color: "red" },
|
|
55
|
+
{ kind: "square", x: 0, y: 0, w: 2, h: 2, color: "blue" },
|
|
56
|
+
{ kind: "quarter", x: 0, y: 2, w: 2, h: 2, color: "yellow" },
|
|
57
|
+
{ kind: "triangle", x: 0, y: 4, w: 2, h: 2, color: "ink" },
|
|
58
|
+
{ kind: "square", x: 2, y: 4, w: 4, h: 1, color: "ink" },
|
|
59
|
+
{ kind: "half", x: 2, y: 5, w: 2, h: 1, color: "red" },
|
|
60
|
+
{ kind: "square", x: 4, y: 5, w: 1, h: 1, color: "yellow" },
|
|
61
|
+
{ kind: "quarter", x: 5, y: 5, w: 1, h: 1, color: "blue", metronome: true },
|
|
62
|
+
];
|
|
63
|
+
const MINIMAL: ShapeDef[] = [
|
|
64
|
+
{ kind: "circle", x: 3, y: 0, w: 3, h: 3, color: "red" },
|
|
65
|
+
{ kind: "square", x: 0, y: 2, w: 1, h: 4, color: "blue" },
|
|
66
|
+
{ kind: "triangle", x: 2, y: 4, w: 2, h: 2, color: "yellow" },
|
|
67
|
+
{ kind: "half", x: 0, y: 0, w: 2, h: 1, color: "ink" },
|
|
68
|
+
{ kind: "quarter", x: 5, y: 5, w: 1, h: 1, color: "ink", metronome: true },
|
|
69
|
+
];
|
|
70
|
+
const ACTION_ORDER = ["move", "pivot", "move", "spin", "orbit", "color"] as const;
|
|
71
|
+
|
|
72
|
+
const quad = Easing.inOut(Easing.quad);
|
|
73
|
+
/** Rounded so the server-rendered still and the client agree to the last digit. */
|
|
74
|
+
const r2 = (v: number) => Math.round(v * 100) / 100;
|
|
75
|
+
const snapHalf = (v: number) => Math.round(v * 2) / 2;
|
|
76
|
+
|
|
77
|
+
function apply(s: State, a: Action, t: number): State {
|
|
78
|
+
switch (a.type) {
|
|
79
|
+
case "move":
|
|
80
|
+
return { ...s, cx: s.cx + a.dx * t, cy: s.cy + a.dy * t };
|
|
81
|
+
case "spin":
|
|
82
|
+
return { ...s, angle: s.angle + 90 * a.dir * t };
|
|
83
|
+
case "pivot": {
|
|
84
|
+
const th = ((a.deg * a.dir * t) / 180) * Math.PI;
|
|
85
|
+
const vx = s.cx - a.px;
|
|
86
|
+
const vy = s.cy - a.py;
|
|
87
|
+
return {
|
|
88
|
+
...s,
|
|
89
|
+
cx: a.px + vx * Math.cos(th) - vy * Math.sin(th),
|
|
90
|
+
cy: a.py + vx * Math.sin(th) + vy * Math.cos(th),
|
|
91
|
+
angle: s.angle + a.deg * a.dir * t,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
case "color":
|
|
95
|
+
return { ...s, color: t > 0 ? a.to : a.from };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A completed action, snapped back onto the grid (no float drift between beats). */
|
|
100
|
+
function applyFull(s: State, a: Action): State {
|
|
101
|
+
const n = apply(s, a, 1);
|
|
102
|
+
return { cx: snapHalf(n.cx), cy: snapHalf(n.cy), angle: Math.round(n.angle), color: n.color };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function inverse(a: Action): Action {
|
|
106
|
+
switch (a.type) {
|
|
107
|
+
case "move":
|
|
108
|
+
return { ...a, dx: -a.dx, dy: -a.dy };
|
|
109
|
+
case "spin":
|
|
110
|
+
return { ...a, dir: -a.dir };
|
|
111
|
+
case "pivot":
|
|
112
|
+
return { ...a, dir: -a.dir };
|
|
113
|
+
case "color":
|
|
114
|
+
return { ...a, from: a.to, to: a.from };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const dims = (def: ShapeDef, angle: number) =>
|
|
119
|
+
Math.abs(Math.round(angle / 90)) % 2 === 1 ? { w: def.h, h: def.w } : { w: def.w, h: def.h };
|
|
120
|
+
|
|
121
|
+
function inBounds(s: State, def: ShapeDef, C: number, R: number) {
|
|
122
|
+
const { w, h } = dims(def, s.angle);
|
|
123
|
+
return s.cx - w / 2 >= -0.01 && s.cx + w / 2 <= C + 0.01 && s.cy - h / 2 >= -0.01 && s.cy + h / 2 <= R + 0.01;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* One shape's moves, one per beat. Built backwards from the end frame: each beat picks an action whose
|
|
128
|
+
* undo stays on the grid, so playing them forwards always lands exactly on the composition.
|
|
129
|
+
*/
|
|
130
|
+
function planShape(def: ShapeDef, index: number, beats: number[], C: number, R: number, seed: number) {
|
|
131
|
+
const final: State = { cx: def.x + def.w / 2, cy: def.y + def.h / 2, angle: 0, color: def.color };
|
|
132
|
+
const actions: Action[] = [];
|
|
133
|
+
let cur = final;
|
|
134
|
+
const start = Math.floor(random(`bh-${seed}-${index}-order`) * ACTION_ORDER.length);
|
|
135
|
+
for (let k = beats.length - 1; k >= 0; k--) {
|
|
136
|
+
const rnd = (key: string) => random(`bh-${seed}-${index}-${k}-${key}`);
|
|
137
|
+
let chosen: { a: Action; pre: State } | null = null;
|
|
138
|
+
for (let attempt = 0; attempt < 12 && !chosen; attempt++) {
|
|
139
|
+
const type = ACTION_ORDER[(start + k + attempt) % ACTION_ORDER.length];
|
|
140
|
+
const r = (key: string) => rnd(`${key}${attempt}`);
|
|
141
|
+
let a: Action | null = null;
|
|
142
|
+
if (type === "move") {
|
|
143
|
+
const mag = (1 + Math.floor(r("m") * 3)) * (r("s") < 0.5 ? -1 : 1);
|
|
144
|
+
a = r("axis") < 0.5 ? { type: "move", dx: mag, dy: 0 } : { type: "move", dx: 0, dy: mag };
|
|
145
|
+
} else if (type === "spin") {
|
|
146
|
+
// A turning circle or square looks still: they roll about a corner instead.
|
|
147
|
+
if (def.kind !== "circle" && !(def.kind === "square" && def.w === def.h)) a = { type: "spin", dir: r("d") < 0.5 ? -1 : 1 };
|
|
148
|
+
} else if (type === "pivot") {
|
|
149
|
+
const { w, h } = dims(def, cur.angle);
|
|
150
|
+
const corner = Math.floor(r("c") * 4);
|
|
151
|
+
a = {
|
|
152
|
+
type: "pivot",
|
|
153
|
+
px: cur.cx + (corner % 2 ? w / 2 : -w / 2),
|
|
154
|
+
py: cur.cy + (corner > 1 ? h / 2 : -h / 2),
|
|
155
|
+
dir: r("d") < 0.5 ? -1 : 1,
|
|
156
|
+
deg: 90,
|
|
157
|
+
};
|
|
158
|
+
} else if (type === "orbit") {
|
|
159
|
+
a = { type: "pivot", px: C / 2, py: R / 2, dir: r("d") < 0.5 ? -1 : 1, deg: 180 };
|
|
160
|
+
} else {
|
|
161
|
+
const others = HUES.filter((hue) => hue !== cur.color && hue !== "ink");
|
|
162
|
+
a = { type: "color", from: others[Math.floor(r("h") * others.length)], to: cur.color };
|
|
163
|
+
}
|
|
164
|
+
if (!a) continue;
|
|
165
|
+
const pre = applyFull(cur, inverse(a));
|
|
166
|
+
if (inBounds(pre, def, C, R)) chosen = { a, pre };
|
|
167
|
+
}
|
|
168
|
+
const fallback: Action = { type: "color", from: cur.color === "red" ? "blue" : "red", to: cur.color };
|
|
169
|
+
const { a, pre } = chosen ?? { a: fallback, pre: applyFull(cur, inverse(fallback)) };
|
|
170
|
+
actions[k] = a;
|
|
171
|
+
cur = pre;
|
|
172
|
+
}
|
|
173
|
+
return { startState: cur, actions };
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function shapePath(kind: Kind, w: number, h: number, fill: string) {
|
|
177
|
+
const [x0, y0, x1, y1] = [r2(-w / 2), r2(-h / 2), r2(w / 2), r2(h / 2)];
|
|
178
|
+
switch (kind) {
|
|
179
|
+
case "circle":
|
|
180
|
+
return <circle r={r2(Math.min(w, h) / 2)} fill={fill} />;
|
|
181
|
+
case "triangle":
|
|
182
|
+
return <polygon points={`${x0},${y1} ${x1},${y1} ${x0},${y0}`} fill={fill} />;
|
|
183
|
+
case "half":
|
|
184
|
+
return <path d={`M ${x0} ${y1} A ${x1} ${x1} 0 0 1 ${x1} ${y1} Z`} fill={fill} />;
|
|
185
|
+
case "quarter":
|
|
186
|
+
return <path d={`M ${x0} ${y1} L ${x0} ${y0} A ${r2(w)} ${r2(h)} 0 0 1 ${x1} ${y1} Z`} fill={fill} />;
|
|
187
|
+
default:
|
|
188
|
+
return <rect x={x0} y={y0} width={r2(w)} height={r2(h)} fill={fill} />;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A kinetic Bauhaus poster: primary-colored circles, triangles, bars and quarter-circles step across a strict
|
|
194
|
+
* grid, one move per beat (slide by whole modules, roll about a corner, swing about the frame center, flip
|
|
195
|
+
* color), lock into a composition, then the title is uncovered by sliding color bars.
|
|
196
|
+
*/
|
|
197
|
+
export function KineticPoster(props: Props) {
|
|
198
|
+
const frame = useCurrentFrame();
|
|
199
|
+
const { width, height, fps, durationInFrames: d } = props;
|
|
200
|
+
const portrait = height > width;
|
|
201
|
+
const hue = (h: Hue) => props[h];
|
|
202
|
+
|
|
203
|
+
// The grid: whole modules across, as many whole rows as fit, centered vertically.
|
|
204
|
+
const C = portrait ? Math.max(4, Math.round((props.cols * 9) / 16)) : Math.round(props.cols);
|
|
205
|
+
const m = width / C;
|
|
206
|
+
const R = Math.max(3, Math.floor(height / m));
|
|
207
|
+
const oy = (height - R * m) / 2;
|
|
208
|
+
|
|
209
|
+
// Shapes take a square region (right in wide, top in mobile); the type gets the rest.
|
|
210
|
+
const S = portrait ? Math.max(3, Math.min(C, R - 4)) : Math.max(3, Math.min(R, Math.floor(C / 2)));
|
|
211
|
+
const regionX = portrait ? Math.floor((C - S) / 2) : C - S;
|
|
212
|
+
const regionY = portrait ? 0 : Math.floor((R - S) / 2);
|
|
213
|
+
const text = portrait
|
|
214
|
+
? { x0: 0, x1: C, y0: S, y1: R }
|
|
215
|
+
: { x0: 0, x1: C - S, y0: 0, y1: R };
|
|
216
|
+
const inText = (i: number, j: number) => i >= text.x0 && i < text.x1 && j >= text.y0 && j < text.y1;
|
|
217
|
+
|
|
218
|
+
const beat = (fps * 60) / props.bpm;
|
|
219
|
+
const bf = (b: number) => Math.round(b * beat);
|
|
220
|
+
const dur = Math.max(3, Math.min(Math.round(beat * 0.6), Math.round(beat) - 1));
|
|
221
|
+
const heroBeat = Math.max(2, Math.round((d * 0.62) / beat));
|
|
222
|
+
const heroFrame = bf(heroBeat);
|
|
223
|
+
const out = exitOut(frame, d, 10);
|
|
224
|
+
const pad = m * 0.22;
|
|
225
|
+
|
|
226
|
+
// Grid lines draw on over the first beat.
|
|
227
|
+
const gridIn = ramp(frame, 0, Math.max(4, beat), Easing.linear);
|
|
228
|
+
const lineW = r2(Math.max(1, m / 110));
|
|
229
|
+
const gridLines = props.showGrid ? (
|
|
230
|
+
<g stroke={props.ink} strokeOpacity={0.14} strokeWidth={lineW}>
|
|
231
|
+
{Array.from({ length: C + 1 }, (_, i) => (
|
|
232
|
+
<line key={`v${i}`} x1={r2(i * m)} x2={r2(i * m)} y1={r2(oy)} y2={r2(oy + R * m * gridIn)} />
|
|
233
|
+
))}
|
|
234
|
+
{Array.from({ length: R + 1 }, (_, j) => (
|
|
235
|
+
<line key={`h${j}`} y1={r2(oy + j * m)} y2={r2(oy + j * m)} x1={0} x2={r2(C * m * gridIn)} />
|
|
236
|
+
))}
|
|
237
|
+
</g>
|
|
238
|
+
) : null;
|
|
239
|
+
|
|
240
|
+
// ── Poster / minimal: shapes planned beat by beat ──────────────────────────────────────────────────────
|
|
241
|
+
const shapes = (() => {
|
|
242
|
+
if (props.layout === "array") return null;
|
|
243
|
+
const base = props.layout === "minimal" ? MINIMAL : POSTER;
|
|
244
|
+
const k = S >= 6 ? 1 : S / 6;
|
|
245
|
+
const off = S >= 6 ? Math.round((S - 6) / 2) : 0;
|
|
246
|
+
return base.map((src, i) => {
|
|
247
|
+
const h = Math.max(1, Math.round(src.h * k));
|
|
248
|
+
const def: ShapeDef = {
|
|
249
|
+
...src,
|
|
250
|
+
x: regionX + off + Math.round(src.x * k),
|
|
251
|
+
y: regionY + off + Math.round(src.y * k),
|
|
252
|
+
h,
|
|
253
|
+
w: src.kind === "half" ? h * 2 : Math.max(1, Math.round(src.w * k)),
|
|
254
|
+
};
|
|
255
|
+
// Shapes appear on eighth notes, then act on every other beat until the hero moment.
|
|
256
|
+
const appear = Math.round((i * beat) / 2);
|
|
257
|
+
const firstBeat = Math.ceil((appear + 1) / beat);
|
|
258
|
+
const beats: number[] = [];
|
|
259
|
+
for (let b = firstBeat; b < heroBeat; b++) if ((b + i) % 2 === 0) beats.push(b);
|
|
260
|
+
const { startState, actions } = planShape(def, i, beats, C, R, props.seed);
|
|
261
|
+
let s = startState;
|
|
262
|
+
for (let n = 0; n < beats.length; n++) {
|
|
263
|
+
const at = bf(beats[n]);
|
|
264
|
+
if (frame < at) break;
|
|
265
|
+
const a = actions[n];
|
|
266
|
+
const t = a.type === "color" ? 1 : ramp(frame, at, dur, quad);
|
|
267
|
+
s = t >= 1 ? applyFull(s, a) : apply(s, a, t);
|
|
268
|
+
if (t < 1) break;
|
|
269
|
+
}
|
|
270
|
+
if (def.metronome && frame >= heroFrame + bf(1)) {
|
|
271
|
+
// A quarter turn every beat after the hero moment.
|
|
272
|
+
const since = frame - heroFrame;
|
|
273
|
+
const done = Math.floor(since / beat);
|
|
274
|
+
s = { ...s, angle: s.angle + 90 * (done - 1 + ramp(frame, heroFrame + bf(done), dur, quad)) };
|
|
275
|
+
}
|
|
276
|
+
if (frame < appear) return null;
|
|
277
|
+
return (
|
|
278
|
+
<g key={i} transform={`translate(${r2(s.cx * m)} ${r2(oy + s.cy * m)}) rotate(${r2(s.angle)})`}>
|
|
279
|
+
{shapePath(def.kind, def.w * m, def.h * m, hue(s.color))}
|
|
280
|
+
</g>
|
|
281
|
+
);
|
|
282
|
+
});
|
|
283
|
+
})();
|
|
284
|
+
|
|
285
|
+
// ── Array: a Truchet field of quarter-circles that turn on the beat in phase waves ────────────────────────
|
|
286
|
+
const tiles = (() => {
|
|
287
|
+
if (props.layout !== "array") return null;
|
|
288
|
+
const now = Math.floor(frame / beat);
|
|
289
|
+
const cells = [];
|
|
290
|
+
for (let j = 0; j < R; j++) {
|
|
291
|
+
for (let i = 0; i < C; i++) {
|
|
292
|
+
const key = `${props.seed}-${i}-${j}`;
|
|
293
|
+
const appear = Math.round((Math.floor(((i + j) / Math.max(1, C + R - 2)) * 8) * beat) / 4);
|
|
294
|
+
if (frame < appear) continue;
|
|
295
|
+
if (inText(i, j)) {
|
|
296
|
+
const rel = portrait ? i + (j - text.y0) : i + j * 0.5;
|
|
297
|
+
if (frame >= heroFrame + Math.round((rel * beat) / 4)) continue;
|
|
298
|
+
}
|
|
299
|
+
// Rounded before bucketing so the server-rendered still and the browser pick the same tile.
|
|
300
|
+
const v = r3(Math.sin(i * 0.75 + props.seed) * Math.cos(j * 0.6 + props.seed * 0.37) + 0.35 * Math.sin((i + j) * 0.5));
|
|
301
|
+
if (Math.abs(v) < 0.1) continue;
|
|
302
|
+
const color = HUES[Math.min(3, Math.max(0, Math.floor(((v + 1.35) / 2.7) * 4)))];
|
|
303
|
+
const dir = (i + j) % 2 ? 1 : -1;
|
|
304
|
+
let turns = Math.floor(random(`q${key}`) * 4);
|
|
305
|
+
let partial = 0;
|
|
306
|
+
for (let b = 1; b <= now; b++) {
|
|
307
|
+
const wave = r3(0.5 + 0.5 * Math.sin(i * 0.6 + j * 0.45 - b * 0.9 + props.seed));
|
|
308
|
+
if (random(`t${key}-${b}`) < wave * 0.7) {
|
|
309
|
+
if (b < now) turns += 1;
|
|
310
|
+
else partial = ramp(frame, bf(b), dur, quad);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
const kind: Kind = random(`k${key}`) < 0.82 ? "quarter" : random(`k2${key}`) < 0.5 ? "circle" : "triangle";
|
|
314
|
+
cells.push(
|
|
315
|
+
<g
|
|
316
|
+
key={key}
|
|
317
|
+
transform={`translate(${r2((i + 0.5) * m)} ${r2(oy + (j + 0.5) * m)}) rotate(${r2(90 * dir * (turns + partial))})`}
|
|
318
|
+
>
|
|
319
|
+
{shapePath(kind, kind === "circle" ? m * 0.76 : m, kind === "circle" ? m * 0.76 : m, hue(color))}
|
|
320
|
+
</g>,
|
|
321
|
+
);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return cells;
|
|
325
|
+
})();
|
|
326
|
+
|
|
327
|
+
// ── Type ───────────────────────────────────────────────────────────────────────────────────────────────
|
|
328
|
+
const box = {
|
|
329
|
+
left: text.x0 * m + pad,
|
|
330
|
+
right: text.x1 * m - pad,
|
|
331
|
+
top: oy + text.y0 * m + pad,
|
|
332
|
+
bottom: oy + text.y1 * m - pad,
|
|
333
|
+
};
|
|
334
|
+
const lines = props.title.filter((l) => l.trim());
|
|
335
|
+
const maxChars = Math.max(4, ...lines.map((l) => l.replace(/\*/g, "").length));
|
|
336
|
+
const kickerSize = Math.max(12, m * 0.15);
|
|
337
|
+
const fontSize = Math.min(
|
|
338
|
+
(box.right - box.left) / (maxChars * 0.56),
|
|
339
|
+
((box.bottom - box.top - kickerSize * 3) * 0.9) / Math.max(1, lines.length * 0.92),
|
|
340
|
+
m * 1.8,
|
|
341
|
+
);
|
|
342
|
+
const barColors = [props.ink, props.red, props.blue];
|
|
343
|
+
const covered = props.layout !== "array";
|
|
344
|
+
const typeLayer = (
|
|
345
|
+
<AbsoluteFill>
|
|
346
|
+
{props.kicker && frame >= (covered ? bf(1) : 0) ? (
|
|
347
|
+
<div
|
|
348
|
+
style={{
|
|
349
|
+
position: "absolute",
|
|
350
|
+
left: r2(box.left),
|
|
351
|
+
top: r2(box.top),
|
|
352
|
+
display: "flex",
|
|
353
|
+
alignItems: "center",
|
|
354
|
+
gap: r2(kickerSize * 0.7),
|
|
355
|
+
fontFamily: FONTS[props.font] ?? FONTS.grotesk,
|
|
356
|
+
fontWeight: 600,
|
|
357
|
+
fontSize: r2(kickerSize),
|
|
358
|
+
letterSpacing: "0.14em",
|
|
359
|
+
textTransform: "uppercase",
|
|
360
|
+
color: props.ink,
|
|
361
|
+
whiteSpace: "nowrap",
|
|
362
|
+
}}
|
|
363
|
+
>
|
|
364
|
+
<div style={{ width: r2(kickerSize * 0.75), height: r2(kickerSize * 0.75), background: props.red }} />
|
|
365
|
+
{props.kicker}
|
|
366
|
+
</div>
|
|
367
|
+
) : null}
|
|
368
|
+
<div
|
|
369
|
+
style={{
|
|
370
|
+
position: "absolute",
|
|
371
|
+
left: r2(box.left),
|
|
372
|
+
bottom: r2(height - box.bottom),
|
|
373
|
+
display: "flex",
|
|
374
|
+
flexDirection: "column",
|
|
375
|
+
alignItems: "flex-start",
|
|
376
|
+
gap: r2(fontSize * 0.06),
|
|
377
|
+
}}
|
|
378
|
+
>
|
|
379
|
+
{lines.map((line, i) => {
|
|
380
|
+
const barIn = bf(1 + i);
|
|
381
|
+
const reveal = ramp(frame, heroFrame + i * Math.round(beat / 2), dur, quad);
|
|
382
|
+
if (covered && frame < barIn) return <div key={i} style={{ height: r2(fontSize * 0.92) }} />;
|
|
383
|
+
return (
|
|
384
|
+
<div key={i} style={{ position: "relative", overflow: "hidden" }}>
|
|
385
|
+
<div
|
|
386
|
+
style={{
|
|
387
|
+
fontFamily: FONTS[props.font] ?? FONTS.grotesk,
|
|
388
|
+
fontWeight: 700,
|
|
389
|
+
fontSize: r2(fontSize),
|
|
390
|
+
lineHeight: 0.92,
|
|
391
|
+
letterSpacing: "-0.045em",
|
|
392
|
+
color: props.ink,
|
|
393
|
+
whiteSpace: "nowrap",
|
|
394
|
+
paddingRight: r2(fontSize * 0.06),
|
|
395
|
+
}}
|
|
396
|
+
>
|
|
397
|
+
{splitHighlights(line).map((word, w) => (
|
|
398
|
+
<span key={w} style={{ color: word.highlighted ? props.red : undefined }}>
|
|
399
|
+
{w > 0 ? " " : ""}
|
|
400
|
+
{word.text}
|
|
401
|
+
</span>
|
|
402
|
+
))}
|
|
403
|
+
</div>
|
|
404
|
+
{covered && reveal < 1 ? (
|
|
405
|
+
<div
|
|
406
|
+
style={{
|
|
407
|
+
position: "absolute",
|
|
408
|
+
inset: 0,
|
|
409
|
+
background: barColors[i % barColors.length],
|
|
410
|
+
transform: `translateX(${r2(reveal * 101)}%)`,
|
|
411
|
+
}}
|
|
412
|
+
/>
|
|
413
|
+
) : null}
|
|
414
|
+
</div>
|
|
415
|
+
);
|
|
416
|
+
})}
|
|
417
|
+
</div>
|
|
418
|
+
</AbsoluteFill>
|
|
419
|
+
);
|
|
420
|
+
|
|
421
|
+
return (
|
|
422
|
+
<AbsoluteFill style={{ background: props.paper, opacity: out }}>
|
|
423
|
+
<svg width={width} height={height} style={{ position: "absolute", inset: 0 }}>
|
|
424
|
+
{gridLines}
|
|
425
|
+
{shapes}
|
|
426
|
+
</svg>
|
|
427
|
+
{typeLayer}
|
|
428
|
+
{tiles ? (
|
|
429
|
+
<svg width={width} height={height} style={{ position: "absolute", inset: 0 }}>
|
|
430
|
+
{tiles}
|
|
431
|
+
</svg>
|
|
432
|
+
) : null}
|
|
433
|
+
</AbsoluteFill>
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
const r3 = (v: number) => Math.round(v * 1000) / 1000;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "kinetic-poster",
|
|
3
|
+
"name": "Kinetic Poster",
|
|
4
|
+
"category": "Text & Titles",
|
|
5
|
+
"description": "A kinetic Bauhaus poster: primary-colored circles, triangles, bars and quarter-circles step across a strict grid one move per beat, lock into a composition, then sliding color bars uncover a Swiss-style title.",
|
|
6
|
+
"useWhen": "A bold, designed title card or chapter opener: a launch name, a manifesto line, a design or architecture topic, an event poster, anything cut to music (set bpm to the track). \"array\" turns it into a pattern field of turning tiles that clears to the title; \"minimal\" keeps a few big shapes and lots of paper.",
|
|
7
|
+
"durationInFrames": 150,
|
|
8
|
+
"layer": "full",
|
|
9
|
+
"tags": ["bauhaus", "geometric", "swiss", "grid", "poster", "kinetic", "shapes", "primary colors", "beat", "modernist"],
|
|
10
|
+
"props": {
|
|
11
|
+
"title": { "type": "lines", "label": "Title", "default": ["Form follows", "*function.*"], "max": 3, "help": "One line per row. *Starred* words print in red." },
|
|
12
|
+
"kicker": { "type": "text", "label": "Kicker", "default": "Kinetic poster Nº 01", "help": "Small caps line at the top of the type area. Leave empty for none." },
|
|
13
|
+
"layout": { "type": "select", "label": "Layout", "default": "poster", "options": [{ "value": "poster", "label": "Poster" }, { "value": "array", "label": "Tile array" }, { "value": "minimal", "label": "Minimal" }] },
|
|
14
|
+
"red": { "type": "color", "label": "Red", "default": "#e63b2e" },
|
|
15
|
+
"yellow": { "type": "color", "label": "Yellow", "default": "#f2b31b" },
|
|
16
|
+
"blue": { "type": "color", "label": "Blue", "default": "#1f4fa8" },
|
|
17
|
+
"ink": { "type": "color", "label": "Ink", "default": "#141414", "help": "Black shapes, grid and text." },
|
|
18
|
+
"paper": { "type": "color", "label": "Paper", "default": "#f1ebdd" },
|
|
19
|
+
"bpm": { "type": "number", "label": "Tempo", "default": 120, "min": 60, "max": 200, "step": 1, "unit": "bpm", "help": "One move per beat: match it to the music." },
|
|
20
|
+
"cols": { "type": "number", "label": "Grid columns", "default": 12, "min": 8, "max": 20, "step": 1, "help": "Across a wide frame (mobile uses about half)." },
|
|
21
|
+
"showGrid": { "type": "boolean", "label": "Grid lines", "default": true },
|
|
22
|
+
"font": { "type": "select", "label": "Font", "default": "grotesk", "options": [{ "value": "grotesk", "label": "Space Grotesk" }, { "value": "sans", "label": "Inter" }, { "value": "display", "label": "Bricolage" }, { "value": "wide", "label": "Unbounded" }, { "value": "condensed", "label": "Anton" }] },
|
|
23
|
+
"seed": { "type": "number", "label": "Pattern", "default": 3, "min": 0, "max": 99, "step": 1 }
|
|
24
|
+
},
|
|
25
|
+
"examples": [
|
|
26
|
+
{ "name": "Poster", "props": {} },
|
|
27
|
+
{ "name": "Tile array", "props": { "layout": "array", "title": ["Order", "in *motion*"], "kicker": "Dessau · 1925", "seed": 7 } },
|
|
28
|
+
{ "name": "Night minimal", "props": { "layout": "minimal", "title": ["Less, but", "*better.*"], "kicker": "Design principles", "ink": "#f1ebdd", "paper": "#141414", "showGrid": false, "font": "sans" } }
|
|
29
|
+
],
|
|
30
|
+
"stillAt": 0.86
|
|
31
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { AbsoluteFill, interpolate, useCurrentFrame } from "remotion";
|
|
2
|
+
import { FONTS, blurStyle, easeOutExpo, fill, unit } from "../lib";
|
|
3
|
+
import type { MotionBaseProps } from "../types";
|
|
4
|
+
|
|
5
|
+
type Props = MotionBaseProps & {
|
|
6
|
+
words: string[];
|
|
7
|
+
beat: number;
|
|
8
|
+
color: string;
|
|
9
|
+
accent: string;
|
|
10
|
+
background: string;
|
|
11
|
+
flashBackground: string;
|
|
12
|
+
size: number;
|
|
13
|
+
font: string;
|
|
14
|
+
weight: string;
|
|
15
|
+
uppercase: boolean;
|
|
16
|
+
alternate: boolean;
|
|
17
|
+
shake: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Fast kinetic type: one word (or short phrase) per beat, slammed in from a big blurred scale and
|
|
22
|
+
* creeping forward while it holds. Every other beat can flip the colors for a strobe-like rhythm.
|
|
23
|
+
*/
|
|
24
|
+
export function KineticPunch(props: Props) {
|
|
25
|
+
const frame = useCurrentFrame();
|
|
26
|
+
const { width, height, durationInFrames: d } = props;
|
|
27
|
+
const u = unit(width, height);
|
|
28
|
+
const vertical = height > width;
|
|
29
|
+
const words = props.words.length ? props.words : [""];
|
|
30
|
+
// Beats shrink to fit if the clip is shorter than all the words at the chosen pace.
|
|
31
|
+
const beat = Math.max(4, Math.min(props.beat, d / words.length));
|
|
32
|
+
const index = Math.min(words.length - 1, Math.floor(frame / beat));
|
|
33
|
+
const local = frame - index * beat;
|
|
34
|
+
const word = words[index];
|
|
35
|
+
const flipped = props.alternate && index % 2 === 1;
|
|
36
|
+
const fg = flipped ? props.flashBackground : index % 2 === 1 ? props.accent : props.color;
|
|
37
|
+
const bg = flipped ? props.accent : props.background;
|
|
38
|
+
|
|
39
|
+
// Size from the longest line in this beat, so long phrases still fit.
|
|
40
|
+
const longest = Math.max(1, ...word.split("|").map((part) => part.length));
|
|
41
|
+
const base = (props.size / 100) * Math.min(width, height) * (vertical ? 1.15 : 1);
|
|
42
|
+
const fontSize = Math.min(base, (width * (vertical ? 0.86 : 0.8)) / (longest * 0.56));
|
|
43
|
+
const t = interpolate(local, [0, Math.min(6, beat * 0.5)], [0, 1], {
|
|
44
|
+
extrapolateLeft: "clamp",
|
|
45
|
+
extrapolateRight: "clamp",
|
|
46
|
+
easing: easeOutExpo,
|
|
47
|
+
});
|
|
48
|
+
const creep = 1 + (local / beat) * 0.06;
|
|
49
|
+
const scale = (1.6 - 0.6 * t) * creep;
|
|
50
|
+
const shake = props.shake && local < 5 ? Math.sin(local * 2.7 + index) * (5 - local) * 3 * u : 0;
|
|
51
|
+
const lastFade = interpolate(frame, [d - 6, d], [1, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<AbsoluteFill style={{ background: fill(bg), alignItems: "center", justifyContent: "center", opacity: lastFade }}>
|
|
55
|
+
<div
|
|
56
|
+
style={{
|
|
57
|
+
display: "flex",
|
|
58
|
+
flexDirection: "column",
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
fontFamily: FONTS[props.font] ?? FONTS.condensed,
|
|
61
|
+
fontWeight: Number(props.weight) || 800,
|
|
62
|
+
fontSize,
|
|
63
|
+
lineHeight: 0.92,
|
|
64
|
+
letterSpacing: "-0.02em",
|
|
65
|
+
textTransform: props.uppercase ? "uppercase" : undefined,
|
|
66
|
+
color: fg,
|
|
67
|
+
transform: `translate(${shake}px, ${shake * 0.4}px) scale(${scale})`,
|
|
68
|
+
opacity: Math.min(1, t * 2),
|
|
69
|
+
...blurStyle((1 - t) * fontSize * 0.08),
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
{word.split("|").map((part, i) => (
|
|
73
|
+
<span key={i} style={{ whiteSpace: "nowrap" }}>
|
|
74
|
+
{part}
|
|
75
|
+
</span>
|
|
76
|
+
))}
|
|
77
|
+
</div>
|
|
78
|
+
</AbsoluteFill>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "kinetic-punch",
|
|
3
|
+
"name": "Kinetic Punch",
|
|
4
|
+
"category": "Text & Titles",
|
|
5
|
+
"description": "Fast kinetic typography: one word per beat slams in from a blurred scale, with optional color flips on every other beat.",
|
|
6
|
+
"useWhen": "High-energy intros, hype reels and social cuts: a string of short words that land on the music's beats (\"Record. Edit. Ship.\"). Set the beat to the song's beat length in frames (30 fps: 120 BPM = 15 frames). Use | inside a word to break it onto two lines.",
|
|
7
|
+
"durationInFrames": 90,
|
|
8
|
+
"layer": "full",
|
|
9
|
+
"tags": ["kinetic type", "beat", "punch", "hype", "social", "fast", "music", "strobe"],
|
|
10
|
+
"props": {
|
|
11
|
+
"words": { "type": "lines", "label": "Words", "default": ["Record.", "Edit.", "Polish.", "Ship.", "Repeat."], "max": 16, "help": "One per beat. Use | for a line break inside a beat." },
|
|
12
|
+
"beat": { "type": "number", "label": "Beat", "default": 15, "min": 4, "max": 45, "step": 1, "unit": "frames", "help": "Frames per word (shrinks to fit the clip)." },
|
|
13
|
+
"color": { "type": "color", "style": "text", "label": "Text", "default": "#ffffff" },
|
|
14
|
+
"accent": { "type": "color", "style": "accent", "label": "Accent", "default": "#d9f99d" },
|
|
15
|
+
"background": { "type": "color", "style": "backdrop", "label": "Background", "default": "#0b0d10", "help": "\"transparent\" to sit over footage." },
|
|
16
|
+
"flashBackground": { "type": "color", "style": "backdrop", "label": "Flip text", "default": "#0b0d10", "help": "Text color on the flipped (accent) beats." },
|
|
17
|
+
"size": { "type": "number", "label": "Size", "default": 32, "min": 8, "max": 60, "step": 1, "unit": "% of frame", "help": "Largest size; long words shrink to fit." },
|
|
18
|
+
"font": { "type": "select", "style": "font", "label": "Font", "default": "condensed", "options": [{ "value": "condensed", "label": "Anton" }, { "value": "wide", "label": "Unbounded" }, { "value": "sans", "label": "Inter" }, { "value": "display", "label": "Bricolage" }, { "value": "serif", "label": "Instrument Serif" }, { "value": "fraunces", "label": "Fraunces" }, { "value": "grotesk", "label": "Space Grotesk" }, { "value": "syne", "label": "Syne" }, { "value": "mono", "label": "Mono" }, { "value": "archivo", "label": "Archivo Black" }, { "value": "caveat", "label": "Caveat" }, { "value": "pixel", "label": "VT323" }, { "value": "tech", "label": "Orbitron" }, { "value": "heavy", "label": "Montserrat" }, { "value": "retro", "label": "Bungee" }] },
|
|
19
|
+
"weight": { "type": "select", "style": "weight", "label": "Weight", "default": "400", "options": [{ "value": "400", "label": "Regular" }, { "value": "700", "label": "Bold" }, { "value": "800", "label": "Extra bold" }, { "value": "900", "label": "Black" }] },
|
|
20
|
+
"uppercase": { "type": "boolean", "label": "Uppercase", "default": true },
|
|
21
|
+
"alternate": { "type": "boolean", "label": "Flip colors every other beat", "default": true },
|
|
22
|
+
"shake": { "type": "boolean", "label": "Impact shake", "default": true }
|
|
23
|
+
},
|
|
24
|
+
"examples": [
|
|
25
|
+
{ "name": "Strobe", "props": {} },
|
|
26
|
+
{ "name": "Over footage", "props": { "background": "transparent", "alternate": false, "words": ["No", "more", "boring|demos"], "beat": 20, "font": "wide", "weight": "800", "size": 22 } },
|
|
27
|
+
{ "name": "Serif rhythm", "props": { "words": ["Slow", "down.", "Look", "closer."], "font": "serif", "uppercase": false, "accent": "#fca5a5", "background": "#1c1917", "beat": 18, "shake": false } }
|
|
28
|
+
],
|
|
29
|
+
"stillAt": 0.1
|
|
30
|
+
}
|