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,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "sticker-slam",
|
|
3
|
+
"name": "Sticker Slam",
|
|
4
|
+
"category": "Text & Titles",
|
|
5
|
+
"description": "Your brand as a die-cut sticker in the middle while the background hard-cuts between surfaces (laptop lid, brick wall, skate deck, street sign, cardboard box…), the sticker snapping to a new tilt on every cut.",
|
|
6
|
+
"useWhen": "A loud, social-first brand intro or outro: a logo or product name that's \"everywhere\", merch and streetwear drops, launch hype reels, the end card of a TikTok or Reel. Pass your own photos in images to cut between real places.",
|
|
7
|
+
"durationInFrames": 90,
|
|
8
|
+
"layer": "full",
|
|
9
|
+
"tags": ["sticker", "brand", "logo", "intro", "outro", "hype", "streetwear", "fast cuts", "montage", "social", "tiktok"],
|
|
10
|
+
"props": {
|
|
11
|
+
"name": { "type": "text", "label": "Name", "default": "agentcut", "maxLength": 24 },
|
|
12
|
+
"tagline": { "type": "text", "label": "Tagline", "default": "", "help": "A small line under the sticker. Leave empty for none." },
|
|
13
|
+
"mark": { "type": "select", "label": "Mark", "default": "star", "options": [{ "value": "none", "label": "None" }, { "value": "star", "label": "Star" }, { "value": "dot", "label": "Dot" }, { "value": "bolt", "label": "Bolt" }, { "value": "heart", "label": "Heart" }] },
|
|
14
|
+
"shape": { "type": "select", "label": "Shape", "default": "rounded", "options": [{ "value": "rounded", "label": "Rounded" }, { "value": "pill", "label": "Pill" }, { "value": "circle", "label": "Circle" }, { "value": "text-cut", "label": "Cut around the text" }], "help": "\"Cut around the text\" outlines the letters themselves (they take the sticker color)." },
|
|
15
|
+
"color": { "type": "color", "label": "Sticker", "default": "#111111" },
|
|
16
|
+
"textColor": { "type": "color", "label": "Text", "default": "#c6ff3d" },
|
|
17
|
+
"border": { "type": "color", "label": "Die-cut border", "default": "#ffffff" },
|
|
18
|
+
"font": { "type": "select", "label": "Font", "default": "display", "options": [{ "value": "display", "label": "Bricolage" }, { "value": "sans", "label": "Inter" }, { "value": "serif", "label": "Instrument Serif" }, { "value": "fraunces", "label": "Fraunces" }, { "value": "grotesk", "label": "Space Grotesk" }, { "value": "syne", "label": "Syne" }, { "value": "wide", "label": "Unbounded" }, { "value": "condensed", "label": "Anton" }, { "value": "mono", "label": "Mono" }] },
|
|
19
|
+
"weight": { "type": "select", "label": "Weight", "default": "800", "options": [{ "value": "400", "label": "Regular" }, { "value": "500", "label": "Medium" }, { "value": "700", "label": "Bold" }, { "value": "800", "label": "Extra bold" }] },
|
|
20
|
+
"size": { "type": "number", "label": "Size", "default": 12, "min": 5, "max": 22, "step": 0.5, "unit": "% of frame", "help": "Long names shrink to fit." },
|
|
21
|
+
"cutEvery": { "type": "number", "label": "Cut every", "default": 5, "min": 2, "max": 20, "step": 1, "unit": "frames" },
|
|
22
|
+
"tilt": { "type": "number", "label": "Tilt", "default": 10, "min": 0, "max": 14, "step": 1, "unit": "°", "help": "How far the sticker swings left and right between cuts." },
|
|
23
|
+
"peel": { "type": "boolean", "label": "Peeled corner", "default": true, "help": "Not drawn on \"Cut around the text\"." },
|
|
24
|
+
"flash": { "type": "boolean", "label": "Flash on cuts", "default": false },
|
|
25
|
+
"images": { "type": "lines", "label": "Images", "default": [], "max": 12, "help": "Image URLs to cut between instead of the drawn surfaces (must allow cross-origin loading)." },
|
|
26
|
+
"seed": { "type": "number", "label": "Shuffle", "default": 7, "min": 0, "max": 999, "step": 1, "help": "Another order of surfaces and tilts." }
|
|
27
|
+
},
|
|
28
|
+
"examples": [
|
|
29
|
+
{ "name": "Slap", "props": {} },
|
|
30
|
+
{ "name": "Streetwear", "props": { "name": "NO SLEEP CLUB", "tagline": "Drop 03 · Friday", "mark": "bolt", "shape": "text-cut", "color": "#ff3b30", "border": "#ffffff", "font": "condensed", "weight": "400", "size": 16, "cutEvery": 3, "tilt": 14, "flash": true, "seed": 42 } },
|
|
31
|
+
{ "name": "Clean SaaS", "props": { "name": "Northwind", "tagline": "Now in beta", "mark": "dot", "shape": "pill", "color": "#ffffff", "textColor": "#0f172a", "border": "#ffffff", "font": "sans", "weight": "800", "cutEvery": 8, "tilt": 6, "peel": false, "seed": 3 } }
|
|
32
|
+
],
|
|
33
|
+
"stillAt": 0.5
|
|
34
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// What a project style does to the whole video, beyond the component props: camera moves on the
|
|
2
|
+
// footage, a texture over everything, and captions drawn in the style's look. The studio runtime
|
|
3
|
+
// calls these (when the page provides them), so a new or changed style ships with the page.
|
|
4
|
+
import type { CSSProperties } from "react";
|
|
5
|
+
import { AbsoluteFill, useCurrentFrame, useVideoConfig } from "remotion";
|
|
6
|
+
import { FONTS, alpha, unit } from "./lib";
|
|
7
|
+
import { Chip, Grain, Scanlines, Vignette, hash, lookKit, type LookProps } from "./looks";
|
|
8
|
+
import { getMotionStyle, type MotionStyle } from "./styles";
|
|
9
|
+
|
|
10
|
+
/** The style's tokens as look props (the first of its fonts the library has). */
|
|
11
|
+
export function styleLookProps(style: MotionStyle): LookProps {
|
|
12
|
+
const font = style.tokens.font.split(",").map((f) => f.trim()).find((f) => f in FONTS) ?? "archivo";
|
|
13
|
+
return {
|
|
14
|
+
look: style.look,
|
|
15
|
+
accent: style.tokens.accent,
|
|
16
|
+
panel: style.tokens.panel,
|
|
17
|
+
panelText: style.tokens.panelText,
|
|
18
|
+
line: style.tokens.line,
|
|
19
|
+
backdrop: style.tokens.backdrop,
|
|
20
|
+
onVideo: style.tokens.text,
|
|
21
|
+
font,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The style's camera on a footage clip at `frame` (clip-local): jump-cut punch-ins with a shake,
|
|
27
|
+
* stop-motion snaps, a slow drift or glitch jumps. Null when the style keeps the camera still.
|
|
28
|
+
*/
|
|
29
|
+
export function styleCamera(
|
|
30
|
+
styleId: string | null | undefined,
|
|
31
|
+
{ frame, durationInFrames, width, height }: { frame: number; durationInFrames: number; width: number; height: number },
|
|
32
|
+
): CSSProperties | null {
|
|
33
|
+
const style = getMotionStyle(styleId);
|
|
34
|
+
const cam = style?.camera;
|
|
35
|
+
if (!cam) return null;
|
|
36
|
+
const moved = moveCamera(cam, { frame, durationInFrames, width, height });
|
|
37
|
+
if (!cam.grade) return moved;
|
|
38
|
+
return { ...moved, filter: cam.grade };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function moveCamera(
|
|
42
|
+
cam: NonNullable<ReturnType<typeof getMotionStyle>>["camera"],
|
|
43
|
+
{ frame, durationInFrames, width, height }: { frame: number; durationInFrames: number; width: number; height: number },
|
|
44
|
+
): CSSProperties | null {
|
|
45
|
+
if (cam.mode === "still") return null;
|
|
46
|
+
const u = unit(width, height);
|
|
47
|
+
const every = Math.max(8, cam.every);
|
|
48
|
+
const seg = Math.floor(frame / every);
|
|
49
|
+
const t = frame - seg * every;
|
|
50
|
+
const origin = "50% 38%";
|
|
51
|
+
switch (cam.mode) {
|
|
52
|
+
case "punch": {
|
|
53
|
+
// Cut to a tighter or wider framing every beat, with a short shake on the cut.
|
|
54
|
+
const levels = [1, cam.zoom, 1.04, cam.zoom * 1.05];
|
|
55
|
+
const scale = levels[seg % levels.length];
|
|
56
|
+
const kick = seg > 0 && t < 8 ? (1 - t / 8) * cam.shake * 18 * u : 0;
|
|
57
|
+
const x = (hash(seg, t) - 0.5) * 2 * kick;
|
|
58
|
+
const y = (hash(seg + 3, t) - 0.5) * 2 * kick;
|
|
59
|
+
return { transform: `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px) scale(${scale})`, transformOrigin: origin };
|
|
60
|
+
}
|
|
61
|
+
case "snap": {
|
|
62
|
+
// Stop-motion: held on twos, a little hand jitter, framing steps with a 2-frame overshoot.
|
|
63
|
+
const held = frame - (frame % 2);
|
|
64
|
+
const levels = [1, cam.zoom, 1.05];
|
|
65
|
+
const over = seg > 0 && t < 2 ? 1.03 : 1;
|
|
66
|
+
const scale = levels[seg % levels.length] * over;
|
|
67
|
+
const x = (hash(7, held) - 0.5) * cam.shake * 6 * u;
|
|
68
|
+
const y = (hash(11, held) - 0.5) * cam.shake * 6 * u;
|
|
69
|
+
const r = (hash(13, held) - 0.5) * cam.shake * 0.5;
|
|
70
|
+
return { transform: `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px) rotate(${r.toFixed(2)}deg) scale(${scale})`, transformOrigin: origin };
|
|
71
|
+
}
|
|
72
|
+
case "drift": {
|
|
73
|
+
// A slow push-in across the clip with a gentle sideways sway.
|
|
74
|
+
const p = Math.min(1, frame / Math.max(1, durationInFrames));
|
|
75
|
+
const scale = 1 + (cam.zoom - 1) * p;
|
|
76
|
+
const x = Math.sin(frame / (every * 0.9)) * cam.shake * 10 * u;
|
|
77
|
+
return { transform: `translate(${x.toFixed(1)}px, 0px) scale(${scale.toFixed(4)})`, transformOrigin: origin };
|
|
78
|
+
}
|
|
79
|
+
case "tape": {
|
|
80
|
+
// Worn tape: a slight wobble on twos, and a tracking hiccup (a sideways tear and a roll) every beat.
|
|
81
|
+
const held = frame - (frame % 2);
|
|
82
|
+
const wobble = (hash(5, held) - 0.5) * cam.shake * 3 * u;
|
|
83
|
+
if (seg > 0 && t < 4) {
|
|
84
|
+
const x = (hash(seg, t) - 0.5) * cam.shake * 40 * u;
|
|
85
|
+
const y = -(4 - t) * cam.shake * 6 * u;
|
|
86
|
+
return { transform: `translate(${x.toFixed(1)}px, ${y.toFixed(1)}px) scale(${cam.zoom})`, transformOrigin: origin };
|
|
87
|
+
}
|
|
88
|
+
return { transform: `translate(${wobble.toFixed(1)}px, 0px) scale(${cam.zoom})`, transformOrigin: origin };
|
|
89
|
+
}
|
|
90
|
+
case "glitch": {
|
|
91
|
+
// Still, except a 3-frame jump every beat.
|
|
92
|
+
if (seg > 0 && t < 3) {
|
|
93
|
+
const x = (hash(seg, t) - 0.5) * cam.shake * 60 * u;
|
|
94
|
+
return { transform: `translate(${x.toFixed(1)}px, 0px) scale(${cam.zoom})`, transformOrigin: origin };
|
|
95
|
+
}
|
|
96
|
+
return { transform: "scale(1.02)", transformOrigin: origin };
|
|
97
|
+
}
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** The style's texture over the whole frame: paper grain and copier edges, scanlines, or a vignette. */
|
|
104
|
+
export function StyleOverlay({ styleId }: { styleId: string | null | undefined }) {
|
|
105
|
+
const frame = useCurrentFrame();
|
|
106
|
+
const { width, height, fps } = useVideoConfig();
|
|
107
|
+
const style = getMotionStyle(styleId);
|
|
108
|
+
const overlay = style?.overlay;
|
|
109
|
+
if (!style || !overlay || overlay.kind === "none") return null;
|
|
110
|
+
const u = unit(width, height);
|
|
111
|
+
const amount = overlay.amount;
|
|
112
|
+
return (
|
|
113
|
+
<AbsoluteFill style={{ pointerEvents: "none" }}>
|
|
114
|
+
{overlay.kind === "grain" ? (
|
|
115
|
+
<>
|
|
116
|
+
<Grain opacity={amount} seed={Math.floor(frame / 2) % 12} />
|
|
117
|
+
<Vignette color="#2a1a08" amount={amount * 0.9} />
|
|
118
|
+
</>
|
|
119
|
+
) : null}
|
|
120
|
+
{overlay.kind === "scanlines" ? (
|
|
121
|
+
<>
|
|
122
|
+
<Scanlines u={u} opacity={amount} />
|
|
123
|
+
<div style={{ position: "absolute", inset: 0, background: style.tokens.accent, opacity: 0.035 + hash(frame, 2) * 0.02 }} />
|
|
124
|
+
<Vignette amount={amount * 1.2} />
|
|
125
|
+
</>
|
|
126
|
+
) : null}
|
|
127
|
+
{overlay.kind === "neon" ? (
|
|
128
|
+
<>
|
|
129
|
+
<Scanlines u={u} opacity={amount * 0.5} />
|
|
130
|
+
<div style={{ position: "absolute", inset: 0, background: `linear-gradient(180deg, ${alpha(style.tokens.accent, amount)} 0%, ${alpha(style.tokens.accent, 0)} 18%, ${alpha(style.tokens.line, 0)} 82%, ${alpha(style.tokens.line, amount)} 100%)` }} />
|
|
131
|
+
<Vignette color="#0a0418" amount={amount * 1.6} />
|
|
132
|
+
</>
|
|
133
|
+
) : null}
|
|
134
|
+
{overlay.kind === "vhs" ? <VhsOverlay frame={frame} fps={fps} width={width} height={height} amount={amount} /> : null}
|
|
135
|
+
{overlay.kind === "vignette" ? <Vignette amount={amount} /> : null}
|
|
136
|
+
</AbsoluteFill>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Home-video tape: noise, a tracking band rolling down, a dark TV edge and the camcorder's on-screen text. */
|
|
141
|
+
function VhsOverlay({ frame, fps, width, height, amount }: { frame: number; fps: number; width: number; height: number; amount: number }) {
|
|
142
|
+
const u = unit(width, height);
|
|
143
|
+
const band = ((frame * 9 * u) % (height * 1.6)) - height * 0.3;
|
|
144
|
+
const seconds = Math.floor(frame / fps);
|
|
145
|
+
const counter = `${Math.floor(seconds / 3600)}:${String(Math.floor(seconds / 60) % 60).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
|
|
146
|
+
const osd: CSSProperties = {
|
|
147
|
+
position: "absolute",
|
|
148
|
+
fontFamily: FONTS.pixel,
|
|
149
|
+
fontSize: 48 * u,
|
|
150
|
+
lineHeight: 1,
|
|
151
|
+
color: "#ffffff",
|
|
152
|
+
textShadow: `0 0 ${3 * u}px rgba(0,0,0,0.9), ${-3 * u}px 0 rgba(255,40,60,0.6), ${3 * u}px 0 rgba(40,220,255,0.55)`,
|
|
153
|
+
letterSpacing: "0.04em",
|
|
154
|
+
};
|
|
155
|
+
return (
|
|
156
|
+
<>
|
|
157
|
+
<Grain opacity={amount} seed={frame % 9} warm={false} frequency={1.2} />
|
|
158
|
+
<div style={{ position: "absolute", left: 0, right: 0, top: band, height: 70 * u, overflow: "hidden", opacity: 0.55 }}>
|
|
159
|
+
<Grain opacity={0.9} seed={(frame + 3) % 9} warm={false} frequency={2.2} />
|
|
160
|
+
</div>
|
|
161
|
+
<Scanlines u={u} opacity={amount * 0.7} />
|
|
162
|
+
<Vignette amount={amount * 2.2} />
|
|
163
|
+
<div style={{ ...osd, left: 60 * u, top: 70 * u }}>{"\u25B6 PLAY"}</div>
|
|
164
|
+
<div style={{ ...osd, right: 60 * u, top: 70 * u }}>SP {counter}</div>
|
|
165
|
+
<div style={{ ...osd, left: 60 * u, bottom: 80 * u, fontSize: 40 * u }}>
|
|
166
|
+
OCT 21 1996
|
|
167
|
+
<br />
|
|
168
|
+
4:20 PM
|
|
169
|
+
</div>
|
|
170
|
+
</>
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
interface CaptionWord {
|
|
175
|
+
text: string;
|
|
176
|
+
from: number;
|
|
177
|
+
to: number;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const CAPTION_Y: Record<string, number> = { top: 0.14, center: 0.5, lower: 0.7, bottom: 0.84 };
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* A captions clip drawn in the style's look: the current line as the look's chip (ink box,
|
|
184
|
+
* ransom scraps, handwriting, terminal, pill), each word popping in when spoken and the spoken
|
|
185
|
+
* word in the accent. Frames are clip-local, like the words.
|
|
186
|
+
*/
|
|
187
|
+
export function StyledCaptions({
|
|
188
|
+
styleId,
|
|
189
|
+
words,
|
|
190
|
+
position,
|
|
191
|
+
wordsPerLine,
|
|
192
|
+
fontSize: size,
|
|
193
|
+
}: {
|
|
194
|
+
styleId: string | null | undefined;
|
|
195
|
+
words: CaptionWord[];
|
|
196
|
+
position?: string;
|
|
197
|
+
wordsPerLine?: number;
|
|
198
|
+
fontSize?: number;
|
|
199
|
+
}) {
|
|
200
|
+
const frame = useCurrentFrame();
|
|
201
|
+
const { width, height, fps } = useVideoConfig();
|
|
202
|
+
const style = getMotionStyle(styleId);
|
|
203
|
+
if (!style) return null;
|
|
204
|
+
const perLine = Math.max(1, wordsPerLine ?? style.captions.wordsPerLine ?? 3);
|
|
205
|
+
let current = -1;
|
|
206
|
+
for (let i = 0; i < words.length; i += 1) {
|
|
207
|
+
if (words[i].from <= frame) current = i;
|
|
208
|
+
else break;
|
|
209
|
+
}
|
|
210
|
+
if (current < 0) return null;
|
|
211
|
+
const lineStart = Math.floor(current / perLine) * perLine;
|
|
212
|
+
const line = words.slice(lineStart, lineStart + perLine);
|
|
213
|
+
const last = line[line.length - 1];
|
|
214
|
+
const next = words[lineStart + perLine];
|
|
215
|
+
if (frame > last.to + 12 && (!next || next.from > frame)) return null;
|
|
216
|
+
|
|
217
|
+
const kit = lookKit(styleLookProps(style), unit(width, height));
|
|
218
|
+
const fontSize = size ?? Math.min(width, height) * (height > width ? 0.058 : 0.05);
|
|
219
|
+
const text = line
|
|
220
|
+
.map((word, i) => {
|
|
221
|
+
const clean = word.text.replace(/\*/g, "");
|
|
222
|
+
return lineStart + i === current && frame <= word.to + 2 ? `*${clean}*` : clean;
|
|
223
|
+
})
|
|
224
|
+
.join(" ");
|
|
225
|
+
const y = CAPTION_Y[position ?? style.captions.position ?? "lower"] ?? 0.7;
|
|
226
|
+
return (
|
|
227
|
+
<AbsoluteFill style={{ pointerEvents: "none" }}>
|
|
228
|
+
<div style={{ position: "absolute", left: "7%", right: "7%", top: `${y * 100}%`, transform: "translateY(-50%)", display: "flex", justifyContent: "center", textAlign: "center" }}>
|
|
229
|
+
<Chip kit={kit} line={text} fontSize={fontSize} frame={frame} fps={fps} times={line.map((word) => word.from)} seed={lineStart + 1} />
|
|
230
|
+
</div>
|
|
231
|
+
</AbsoluteFill>
|
|
232
|
+
);
|
|
233
|
+
}
|