Skip to content

Code-first video & image, rendered natively on WebGPU.

example theming

okanasl78ed42cb1dd0
diff --git a/examples/29_capabilities_reel/.gitignore b/examples/29_capabilities_reel/.gitignore
index 0b9dbf2a..4933b4d1 100644
--- a/examples/29_capabilities_reel/.gitignore
+++ b/examples/29_capabilities_reel/.gitignore
@@ -4,3 +4,5 @@ assets/lottie/
assets/svg/
# Synthesized by `pnpm score`.
assets/stems/
+# Freesound CC0 effects, fetched by `pnpm assets`.
+assets/sfx/
diff --git a/examples/29_capabilities_reel/src/fetch-assets.ts b/examples/29_capabilities_reel/src/fetch-assets.ts
index 8d59a88f..f4932195 100644
--- a/examples/29_capabilities_reel/src/fetch-assets.ts
+++ b/examples/29_capabilities_reel/src/fetch-assets.ts
@@ -14,11 +14,12 @@
* | svg/fluent/ | Fluent Emoji, color SVGs (Microsoft) | MIT |
* | svg/twemoji/ | Twemoji 15.1 (jdecked/twemoji) | CC BY 4.0 |
* | svg/lucide/ | Lucide icons, lucide-static | ISC |
+ * | sfx/ | Freesound (freesound.org), HQ previews; ids and authors in manifest.ts SFX | CC0 |
* | fonts/ | copied from the repo's assets/fonts and the renderer's Noto Color Emoji | OFL |
*/
import fs from "node:fs/promises";
import path from "node:path";
-import { FLUENT, LOTTIES, LUCIDE, NOTO, TWEMOJI } from "./manifest.js";
+import { FLUENT, LOTTIES, LUCIDE, NOTO, SFX, TWEMOJI } from "./manifest.js";
import { ASSETS, FONTS, REPO } from "./paths.js";
const FONT_FILES = [
@@ -98,6 +99,9 @@ async function main(): Promise<void> {
),
);
}
+ for (const [name, sfx] of Object.entries(SFX)) {
+ jobs.push(download(sfx.url, path.join(ASSETS, "sfx", `${name}.mp3`)));
+ }
jobs.push(download(NOTO_SANS_ARABIC, path.join(FONTS, "NotoSansArabic.ttf")));
jobs.push(download(NOTO_SANS_HEBREW, path.join(FONTS, "NotoSansHebrew.ttf")));
await fs.mkdir(FONTS, { recursive: true });
diff --git a/examples/29_capabilities_reel/src/film.ts b/examples/29_capabilities_reel/src/film.ts
index 68f88936..e6e7f0d0 100644
--- a/examples/29_capabilities_reel/src/film.ts
+++ b/examples/29_capabilities_reel/src/film.ts
@@ -13,8 +13,9 @@ import {
Transition,
Vignette,
} from "framefields";
+import { SFX, type SfxName } from "./manifest.js";
import { lowpassAt } from "./music.js";
-import { ASSETS } from "./paths.js";
+import { ASSETS, sfx } from "./paths.js";
import { dataScene } from "./scenes/data.js";
import { emojiScene } from "./scenes/emoji.js";
import { finaleScene } from "./scenes/finale.js";
@@ -27,7 +28,7 @@ import { stylizeScene } from "./scenes/stylize.js";
import { typeScene } from "./scenes/type.js";
import { vectorScene } from "./scenes/vector.js";
import { visionScene } from "./scenes/vision.js";
-import { FONT_FILES, FPS, H, INK, registerFonts, W } from "./theme.js";
+import { BAR, BG, FONT_FILES, FPS, H, registerFonts, W } from "./theme.js";
import { CHAPTERS, chapter, TOTAL_FRAMES } from "./timeline.js";
type Builder = (comp: Composition) => unknown | Promise<unknown>;
@@ -53,6 +54,131 @@ const CUTS: Record<
const stem = (name: string) => `${ASSETS}/stems/${name}.wav`;
+/**
+ * The brand's master bus (framefields-social/packages/brand look.master): rumble cut, a little
+ * warmth, the harsh 2.5–6 kHz band dipped, the top shelved off, a small room, then a gentle
+ * compressor. Applied to every layer, then `trim` (a 1:1 compressor is a clean gain stage:
+ * volume can only cut).
+ */
+function master<T extends { apply: (e: never) => T }>(layer: T, trimDb = 7): T {
+ const chain = [
+ Effect.audioParametricEq({
+ type: "highPass",
+ frequency: 40,
+ q: 0.7,
+ gain: 0,
+ }),
+ Effect.audioParametricEq({
+ type: "lowShelf",
+ frequency: 180,
+ gain: 1.5,
+ q: 0.7,
+ }),
+ Effect.audioParametricEq({
+ type: "peak",
+ frequency: 3500,
+ gain: -3,
+ q: 1.2,
+ }),
+ Effect.audioParametricEq({
+ type: "highShelf",
+ frequency: 7000,
+ gain: -4,
+ q: 0.7,
+ }),
+ Effect.audioReverb({
+ roomSize: 0.35,
+ damping: 0.7,
+ wet: 0.12,
+ dry: 1,
+ width: 1,
+ }),
+ Effect.audioCompressor({
+ threshold: -18,
+ ratio: 3,
+ attack: 0.01,
+ release: 0.25,
+ knee: 6,
+ makeupGain: 0, // per layer, a bus make-up would stack up
+ }),
+ ...(trimDb > 0
+ ? [
+ Effect.audioCompressor({
+ threshold: 0,
+ ratio: 1,
+ attack: 0.01,
+ release: 0.1,
+ knee: 0,
+ makeupGain: trimDb,
+ }),
+ ]
+ : []),
+ // A fast, hard limiter last: the engine scales the whole mix down by its single highest
+ // summed peak, so no layer may spike.
+ Effect.audioCompressor({
+ threshold: -10,
+ ratio: 20,
+ attack: 0.0005,
+ release: 0.06,
+ knee: 2,
+ makeupGain: 0,
+ }),
+ ];
+ return chain.reduce((l, e) => l.apply(e as never), layer);
+}
+
+/** One Freesound effect, placed so its peak lands on `frame`. */
+function sfxAt(name: SfxName, frame: number, volume: number, id: string) {
+ const s = SFX[name];
+ const start = Math.max(0, Math.round(frame - s.peakSec * FPS));
+ return master(
+ Layer.audio(sfx(name), {
+ id,
+ startFrame: start,
+ durationFrames: Math.ceil(s.durSec * FPS),
+ volume,
+ }),
+ 2,
+ );
+}
+
+/**
+ * The effects cue sheet, read off the cuts: a riser that stops dead plus a soft impact on chapters
+ * that open on a hard cut (the drops), a light pass-by whoosh peaking mid-transition elsewhere,
+ * pops on the opening's emoji, and the title hit on the last downbeat.
+ */
+function cues(comp: Composition): void {
+ CHAPTERS.forEach((ch, i) => {
+ if (i === 0) return;
+ const c = chapter(ch.id);
+ const t = CUTS[ch.id].transition;
+ if (!t || t.frames === 0) {
+ comp.addAudio(sfxAt("riser", c.start, 0.55, `sfx-riser-${ch.id}`));
+ comp.addAudio(sfxAt("impact", c.start, 0.8, `sfx-impact-${ch.id}`));
+ } else {
+ comp.addAudio(
+ sfxAt(
+ "whoosh",
+ c.start + Math.round(t.frames / 2),
+ 0.6,
+ `sfx-whoosh-${ch.id}`,
+ ),
+ );
+ }
+ });
+ const open = chapter("open");
+ comp.addAudio(
+ sfxAt("impact", open.start + BAR * 2, 0.7, "sfx-impact-open-drop"),
+ );
+ for (let k = 0; k < 8; k++)
+ comp.addAudio(
+ sfxAt("pop", open.start + BAR * 2 + k * 7, 0.3, `sfx-pop-${k}`),
+ );
+ comp.addAudio(
+ sfxAt("titleHit", chapter("finale").start + BAR * 3, 0.8, "sfx-title-hit"),
+ );
+}
+
/** The four stems through the audio nodes. */
export function mix(comp: Composition): void {
const len = { durationFrames: TOTAL_FRAMES + FPS };
@@ -62,106 +188,95 @@ export function mix(comp: Composition): void {
fadeOutCurve: "scurve",
});
comp.addAudio(
- Layer.audio(stem("drums"), { id: "stem-drums", volume: 1.05, ...len })
- .apply(
- Effect.audioCompressor({
- threshold: -16,
- ratio: 4,
- attack: 0.004,
- release: 0.12,
- knee: 6,
- makeupGain: 5,
- }),
- )
- .apply(
- Effect.audioParametricEq({
- type: "lowShelf",
- frequency: 90,
- gain: 3,
- q: 0.8,
- }),
- ),
- );
- comp.addAudio(
- Layer.audio(stem("bass"), { id: "stem-bass", volume: 0.95, ...len })
- // The breakdown's filter sweep, frame-locked to the EQ curve drawn on screen.
- .apply(
- Effect.audioParametricEq({
- type: "lowPass",
- frequency: Signal.programmatic((ctx) => lowpassAt(ctx.frame)),
- q: 1.1,
- gain: 0,
- }),
- )
- .apply(
- Effect.audioCompressor({
- threshold: -20,
- ratio: 2,
- attack: 0.01,
- release: 0.2,
- knee: 6,
- makeupGain: 2.5,
- }),
- ),
+ master(
+ Layer.audio(stem("drums"), { id: "stem-drums", volume: 1.05, ...len })
+ .apply(
+ Effect.audioCompressor({
+ threshold: -16,
+ ratio: 4,
+ attack: 0.004,
+ release: 0.12,
+ knee: 6,
+ makeupGain: 0,
+ }),
+ )
+ .apply(
+ Effect.audioParametricEq({
+ type: "lowShelf",
+ frequency: 90,
+ gain: 3,
+ q: 0.8,
+ }),
+ ),
+ ),
);
comp.addAudio(
- Layer.audio(stem("music"), { id: "stem-music", volume: 1, ...len })
- .apply(
- Effect.audioParametricEq({
- type: "lowPass",
- frequency: Signal.programmatic((ctx) => lowpassAt(ctx.frame)),
- q: 1.4,
- gain: 0,
- }),
- )
- .apply(
- Effect.audioDelay({
- delayTime: 0.375,
- feedback: 0.35,
- wet: 0.22,
- dry: 1,
- pingPong: true,
- }),
- )
- .apply(
- Effect.audioReverb({
- roomSize: 0.82,
- damping: 0.4,
- wet: 0.25,
- dry: 1,
- width: 1,
- }),
- )
- .apply(
- Effect.audioCompressor({
- threshold: -20,
- ratio: 2,
- attack: 0.01,
- release: 0.2,
- knee: 6,
- makeupGain: 2.5,
- }),
- )
- .apply(fadeOut),
+ master(
+ Layer.audio(stem("bass"), { id: "stem-bass", volume: 0.95, ...len })
+ // The breakdown's filter sweep, frame-locked to the EQ curve drawn on screen.
+ .apply(
+ Effect.audioParametricEq({
+ type: "lowPass",
+ frequency: Signal.programmatic((ctx) => lowpassAt(ctx.frame)),
+ q: 1.1,
+ gain: 0,
+ }),
+ )
+ .apply(
+ Effect.audioCompressor({
+ threshold: -20,
+ ratio: 2,
+ attack: 0.01,
+ release: 0.2,
+ knee: 6,
+ makeupGain: 0,
+ }),
+ ),
+ ),
);
comp.addAudio(
- Layer.audio(stem("fx"), { id: "stem-fx", volume: 0.85, ...len })
- // Risers sweep across the stereo field.
- .apply(
- Effect.stereoPanning({
- pan: Signal.programmatic((ctx) => 0.6 * Math.sin(ctx.frame / 9)),
- }),
- )
- .apply(
- Effect.audioReverb({
- roomSize: 0.9,
- damping: 0.3,
- wet: 0.3,
- dry: 1,
- width: 1,
- }),
- ),
+ master(
+ Layer.audio(stem("music"), { id: "stem-music", volume: 1, ...len })
+ .apply(
+ Effect.audioParametricEq({
+ type: "lowPass",
+ frequency: Signal.programmatic((ctx) => lowpassAt(ctx.frame)),
+ q: 1.4,
+ gain: 0,
+ }),
+ )
+ .apply(
+ Effect.audioDelay({
+ delayTime: 0.375,
+ feedback: 0.35,
+ wet: 0.22,
+ dry: 1,
+ pingPong: true,
+ }),
+ )
+ .apply(
+ Effect.audioReverb({
+ roomSize: 0.82,
+ damping: 0.4,
+ wet: 0.25,
+ dry: 1,
+ width: 1,
+ }),
+ )
+ .apply(
+ Effect.audioCompressor({
+ threshold: -20,
+ ratio: 2,
+ attack: 0.01,
+ release: 0.2,
+ knee: 6,
+ makeupGain: 0,
+ }),
+ )
+ .apply(fadeOut),
+ ),
);
+ cues(comp);
}
export async function buildFilm(): Promise<Composition> {
@@ -171,7 +286,7 @@ export async function buildFilm(): Promise<Composition> {
height: H,
fps: FPS,
durationFrames: TOTAL_FRAMES,
- backgroundColor: INK,
+ backgroundColor: BG,
fonts: FONT_FILES,
});
@@ -201,10 +316,10 @@ export async function buildFilm(): Promise<Composition> {
preserveLuminosity: true,
}),
);
- comp.apply(new Vignette({ strength: 28, radius: 1.15, softness: 0.65 }));
+ comp.apply(new Vignette({ strength: 10, radius: 1.3, softness: 0.8 }));
comp.apply(
new FilmGrain({
- strength: 12,
+ strength: 7,
size: 1.4,
monochrome: true,
animated: true,
diff --git a/examples/29_capabilities_reel/src/kit.ts b/examples/29_capabilities_reel/src/kit.ts
index e270a608..b19f203e 100644
--- a/examples/29_capabilities_reel/src/kit.ts
+++ b/examples/29_capabilities_reel/src/kit.ts
@@ -3,8 +3,20 @@
* screen, keyframe shorthands, and small vector helpers.
*/
import fs from "node:fs";
-import { Color, Layer, LayerAnimation } from "framefields";
-import { DISPLAY, H, INK, MONO, MUTED, PAPER, W } from "./theme.js";
+import { Color, GradientMap, Layer, LayerAnimation } from "framefields";
+import {
+ COBALT,
+ DISPLAY,
+ FG,
+ H,
+ MONO,
+ MUTED,
+ NAVY,
+ PAPER,
+ SIGNAL,
+ SKY,
+ W,
+} from "./theme.js";
import { CHAPTERS, chapter as chapterOf } from "./timeline.js";
// biome-ignore lint/suspicious/noExplicitAny: layout nodes are plain specs here.
@@ -52,12 +64,13 @@ export const at = (id: string) => chapterOf(id);
export function hud(
id: string,
apis: string[],
- options: { dark?: boolean; until?: number } = {},
+ options: { dark?: boolean; light?: boolean; until?: number } = {},
): Node {
const c = at(id);
const index = CHAPTERS.findIndex((x) => x.id === id) + 1;
- const fg = options.dark ? INK : PAPER;
- const dim = options.dark ? Color.alpha(INK, 0.6) : MUTED;
+ // Navy on the light ground; white only over night panels (`light`).
+ const fg = options.light ? PAPER : FG;
+ const dim = options.light ? Color.alpha(PAPER, 0.7) : MUTED;
const until = options.until ?? c.frames;
return Layer.flex({
id: `hud-${id}`,
@@ -105,6 +118,18 @@ export function hud(
);
}
+/** Recolors third-party art into the brand blues (GradientMap, by luminance). */
+export const brandTint = (opacity = 1) =>
+ new GradientMap({
+ stops: [
+ { position: 0, color: NAVY },
+ { position: 0.4, color: COBALT },
+ { position: 0.7, color: SIGNAL },
+ { position: 1, color: SKY },
+ ],
+ opacity,
+ });
+
/** Sets a layer's blend mode (for builders such as Layer.vfx that take no layout props). */
export function blend<T>(
node: T,
diff --git a/examples/29_capabilities_reel/src/manifest.ts b/examples/29_capabilities_reel/src/manifest.ts
index da0a7898..c6ff5095 100644
--- a/examples/29_capabilities_reel/src/manifest.ts
+++ b/examples/29_capabilities_reel/src/manifest.ts
@@ -156,3 +156,57 @@ export const LUCIDE = [
"sparkles",
"film",
] as const;
+
+/**
+ * Sound effects from Freesound, all CC0 (public domain): the HQ preview of each sound.
+ * `peakSec` is where the sound hits (measured from its envelope), so it can be placed on the
+ * frame it belongs to rather than where the file starts.
+ */
+export const SFX = {
+ /** Air builds for a second and stops dead: into a hard cut. */
+ riser: {
+ id: 648837,
+ user: "AudioPapkin",
+ title: "Cinematic Woosh SFX-013",
+ peakSec: 2.9,
+ durSec: 4.44,
+ url: "https://cdn.freesound.org/previews/648/648837_8698658-hq.mp3",
+ },
+ /** A light, airy stereo pass-by: under a whip, push or slide. */
+ whoosh: {
+ id: 701104,
+ user: "xkeril",
+ title: "Whoosh stereo light (transition)",
+ peakSec: 0.45,
+ durSec: 2.32,
+ url: "https://cdn.freesound.org/previews/701/701104_13504080-hq.mp3",
+ },
+ /** A warm, soft low hit with a two-second tail: the downbeat of a drop. */
+ impact: {
+ id: 560156,
+ user: "Rizzard",
+ title: "Soft Cinematic Impact",
+ peakSec: 0.15,
+ durSec: 6,
+ url: "https://cdn.freesound.org/previews/560/560156_10825267-hq.mp3",
+ },
+ /** A deep title hit: the last downbeat, on the lockup. */
+ titleHit: {
+ id: 671306,
+ user: "xkeril",
+ title: "Cinematic Hit Bass (title)",
+ peakSec: 0.05,
+ durSec: 7.5,
+ url: "https://cdn.freesound.org/previews/671/671306_13504080-hq.mp3",
+ },
+ /** A short bright pop: emoji popping in. */
+ pop: {
+ id: 824189,
+ user: "Sadiquecat",
+ title: "Pop in sfx",
+ peakSec: 0.15,
+ durSec: 0.56,
+ url: "https://cdn.freesound.org/previews/824/824189_5287430-hq.mp3",
+ },
+} as const;
+export type SfxName = keyof typeof SFX;
diff --git a/examples/29_capabilities_reel/src/paths.ts b/examples/29_capabilities_reel/src/paths.ts
index 8c30e536..07e02c54 100644
--- a/examples/29_capabilities_reel/src/paths.ts
+++ b/examples/29_capabilities_reel/src/paths.ts
@@ -18,6 +18,7 @@ export const twemoji = (name: string) =>
path.join(ASSETS, "svg/twemoji", `${name}.svg`);
export const lucide = (name: string) =>
path.join(ASSETS, "svg/lucide", `${name}.svg`);
+export const sfx = (name: string) => path.join(ASSETS, "sfx", `${name}.mp3`);
export const SCORE = path.join(ASSETS, "score.wav");
/** Example 19's generated clip (run `pnpm assets` there). */
export const DANCER = path.resolve(
@@ -25,3 +26,9 @@ export const DANCER = path.resolve(
"examples/19_framefields_film/assets/dancer.mp4",
);
export const LOGO = path.resolve(REPO, "assets/brand/logo.png");
+/** The brand lockup for light grounds: signal-blue mark, navy name. */
+export const WORDMARK = path.resolve(
+ REPO,
+ "assets/brand/logo-wordmark-light.svg",
+);
+export const MARK = path.resolve(REPO, "assets/brand/logo.svg");
diff --git a/examples/29_capabilities_reel/src/scenes/data.ts b/examples/29_capabilities_reel/src/scenes/data.ts
index 4b8905a5..beafc5d3 100644
--- a/examples/29_capabilities_reel/src/scenes/data.ts
+++ b/examples/29_capabilities_reel/src/scenes/data.ts
@@ -4,7 +4,6 @@
* reveals Curves → SelectiveColor → ColorBalance → ShadowsHighlights → Vignette on the right.
*/
import {
- Color,
ColorBalance,
Curves,
FilmGrain,
@@ -18,19 +17,20 @@ import { REPO } from "../paths.js";
import {
BAR,
BEAT,
- CYAN,
+ BG,
+ COBALT,
DISPLAY,
- EMBER,
- GOLD,
+ FG,
H,
- INK,
- LIME,
+ LINE,
MONO,
MUTED,
+ NAVY,
PAPER,
- PINK,
+ ROYAL,
SANS,
- VIOLET,
+ SIGNAL,
+ SKY,
W,
} from "../theme.js";
@@ -38,15 +38,15 @@ const PORTRAIT = `${REPO}/examples/19_framefields_film/assets/portrait.mp4`;
/** framefields' 74 nodes (nodes/*), by what they do. */
const NODES: Array<[string, number, string]> = [
- ["Stylize", 16, PINK],
- ["Color", 11, EMBER],
- ["Warp", 10, GOLD],
- ["Generate", 10, LIME],
- ["Audio", 8, CYAN],
- ["Optics", 6, VIOLET],
- ["Matte", 6, "#FF8AD8"],
- ["Signal", 4, "#9AE6B4"],
- ["3D light", 3, "#B9C7FF"],
+ ["Stylize", 16, NAVY],
+ ["Color", 11, ROYAL],
+ ["Warp", 10, COBALT],
+ ["Generate", 10, SIGNAL],
+ ["Audio", 8, "#60A5FA"],
+ ["Optics", 6, "#38BDF8"],
+ ["Matte", 6, SKY],
+ ["Signal", 4, "#93C5FD"],
+ ["3D light", 3, "#BFDBFE"],
];
export function dataScene(): Node {
@@ -66,7 +66,7 @@ export function dataScene(): Node {
fontWeight: 800,
fontSize: 76,
letterSpacing: -2,
- fill: PAPER,
+ fill: FG,
}).animate(
keys("opacity", [
[0, 0],
@@ -80,7 +80,7 @@ export function dataScene(): Node {
height: 620,
categories: NODES.map(([name]) => name),
series: [
- { name: "nodes", data: NODES.map(([, v]) => v), color: VIOLET },
+ { name: "nodes", data: NODES.map(([, v]) => v), color: SIGNAL },
],
colors: NODES.map(([, , c]) => c),
yAxis: { min: 0, max: 18, ticks: 6, grid: true },
@@ -88,7 +88,7 @@ export function dataScene(): Node {
fontFamily: SANS,
fontSize: 18,
textColor: MUTED,
- gridColor: Color.alpha("#ffffff", 0.08),
+ gridColor: LINE,
cornerRadius: 8,
animate: {
start: 6,
@@ -110,7 +110,7 @@ export function dataScene(): Node {
legend: false,
fontFamily: SANS,
fontSize: 16,
- textColor: PAPER,
+ textColor: FG,
animate: { start: 14, duration: 30, stagger: 2, ease: "expo.out" },
} as never,
{ id: "data-donut", position: "absolute", x: 1240, y: 250 },
@@ -125,7 +125,7 @@ export function dataScene(): Node {
fontFamily: DISPLAY,
fontWeight: 800,
fontSize: 130,
- fill: PAPER,
+ fill: FG,
}).animate(
keys("scale", [
[0, 0],
@@ -261,7 +261,7 @@ export function dataScene(): Node {
]),
);
- return scene("data", INK, [
+ return scene("data", BG, [
charts,
grade,
hud("data", ["Layer.chart", "withEffects([...grade])", "withMatte(wipe)"]),
diff --git a/examples/29_capabilities_reel/src/scenes/emoji.ts b/examples/29_capabilities_reel/src/scenes/emoji.ts
index 1e2acb97..d27b4053 100644
--- a/examples/29_capabilities_reel/src/scenes/emoji.ts
+++ b/examples/29_capabilities_reel/src/scenes/emoji.ts
@@ -16,17 +16,19 @@ import type { NotoName } from "../manifest.js";
import { emoji } from "../paths.js";
import {
BEAT,
- CYAN,
+ BG,
+ COBALT,
DISPLAY,
+ FG,
FPS,
+ FROST,
H,
- INK,
MONO,
MUTED,
- PAPER,
- PINK,
- VIOLET,
+ SIGNAL,
+ SKY,
W,
+ WHITE,
} from "../theme.js";
import { chapter } from "../timeline.js";
@@ -97,21 +99,14 @@ export async function emojiScene(): Promise<Node> {
height: 34,
rotation: b.r,
borderRadius: 17,
- background: Gradient.linear(
- [
- Color.alpha(CYAN, 0.55),
- Color.alpha(VIOLET, 0.55),
- Color.alpha(PINK, 0.55),
- ],
- 90,
- ),
- borderColor: Color.alpha("#ffffff", 0.45),
+ background: Gradient.linear([SKY, SIGNAL, COBALT], 90),
+ borderColor: Color.alpha("#ffffff", 0.6),
borderWidth: 1.5,
}).withEffect(
new LayerStyle({
outerGlow: {
enabled: true,
- color: CYAN,
+ color: SKY,
opacity: 0.5,
size: 22,
spread: 0,
@@ -152,10 +147,10 @@ export async function emojiScene(): Promise<Node> {
});
world.simulate();
- return scene("emoji", INK, [
- full({ background: Gradient.linear(["#1B0F3A", "#0A0716"], 180) }),
+ return scene("emoji", BG, [
+ full({ background: Gradient.linear([WHITE, FROST], 180) }),
full({
- background: Gradient.radial([Color.alpha(VIOLET, 0.35), "transparent"]),
+ background: Gradient.radial([Color.alpha(SKY, 0.35), "transparent"]),
}),
// The stage shakes with the loudest impact.
full({
@@ -170,18 +165,18 @@ export async function emojiScene(): Promise<Node> {
),
full({
id: "emoji-flash",
- background: "#ffffff",
+ background: SKY,
opacity: 0,
- blendMode: "overlay",
+ blendMode: "multiply",
}).animate(
LayerAnimation.create().signal("opacity", world.impact, {
- multiplier: 0.18,
+ multiplier: 0.12,
}),
),
Layer.text(
[
{ text: "Animated emoji\n" },
- { text: "with real physics", fill: Color.lighten(CYAN, 0.1) },
+ { text: "with real physics", fill: COBALT },
] as never,
{
id: "emoji-title",
@@ -194,8 +189,8 @@ export async function emojiScene(): Promise<Node> {
fontWeight: 800,
fontSize: 84,
lineHeight: 92,
- letterSpacing: -1.5,
- fill: PAPER,
+ letterSpacing: -2.5,
+ fill: FG,
},
).animate(
keys("opacity", [
diff --git a/examples/29_capabilities_reel/src/scenes/finale.ts b/examples/29_capabilities_reel/src/scenes/finale.ts
index 545f0dc8..d1017bb4 100644
--- a/examples/29_capabilities_reel/src/scenes/finale.ts
+++ b/examples/29_capabilities_reel/src/scenes/finale.ts
@@ -1,36 +1,42 @@
/**
* 11 — Finale. A GPU particle vortex that surges on every kick, Lottie fireworks going off round
- * the frame, every emoji SVG orbiting the framefields mark, the name and the install line — then
- * the last hit and an old-TV power-off to black. The asset credits sit along the bottom.
+ * the frame, every emoji SVG orbiting the brand lockup and the install line — then the last hit
+ * and an old-TV power-off to the brand's night blue. The asset credits sit along the bottom.
*/
import {
Color,
- FontManager,
Gradient,
Layer,
LayerAnimation,
LayerStyle,
Signal,
} from "framefields";
-import { blend, full, keys, type Node, popIn, scene } from "../kit.js";
+import {
+ blend,
+ brandTint,
+ full,
+ keys,
+ type Node,
+ popIn,
+ scene,
+} from "../kit.js";
import { FLUENT, TWEMOJI } from "../manifest.js";
import { kick, kickAt } from "../music.js";
-import { fluent, LOGO, lottie, twemoji } from "../paths.js";
-import { still } from "../precomp.js";
+import { fluent, lottie, twemoji, WORDMARK } from "../paths.js";
import {
BAR,
BEAT,
- CYAN,
- DISPLAY,
- GOLD,
+ COBALT,
+ FROST,
H,
- INK,
+ LINE,
MONO,
MUTED,
- PAPER,
- PINK,
- VIOLET,
+ NIGHT,
+ SIGNAL,
+ SKY,
W,
+ WHITE,
} from "../theme.js";
import { chapter } from "../timeline.js";
@@ -42,26 +48,6 @@ export async function finaleScene(): Promise<Node> {
const hit = BAR * 3; // the last downbeat
const off = hit + BEAT * 2; // power-off
- const NAME = {
- fontFamily: DISPLAY,
- fontWeight: 800,
- fontSize: 128,
- letterSpacing: -3,
- };
- const nw = Math.ceil(FontManager.measure("framefields", NAME).width + 60);
- const nameGlow = await still("finale-name", nw, 190, [
- Layer.text("framefields", {
- position: "absolute",
- x: 0,
- y: 0,
- width: nw,
- height: 190,
- ...NAME,
- fill: PAPER,
- align: "center",
- }),
- ]);
-
const vortex = Layer.particles({
id: "finale-vortex",
width: W,
@@ -86,8 +72,8 @@ export async function finaleScene(): Promise<Node> {
sizeJitter: 0.5,
fade: [0.1, 0.4],
shape: "spark",
- blend: "add",
- color: [CYAN, VIOLET, PINK],
+ blend: "normal",
+ color: [SKY, SIGNAL, COBALT],
colorBySpeed: 900,
prewarm: 2,
} as never);
@@ -110,8 +96,8 @@ export async function finaleScene(): Promise<Node> {
height: size * 1.4,
fit: "cover",
startFrame: at,
- }),
- "screen",
+ }).withEffect(brandTint()),
+ "normal",
),
);
@@ -167,130 +153,92 @@ export async function finaleScene(): Promise<Node> {
);
});
- const logo = 230;
const stage = full({
id: "finale-stage",
children: [
- full({ background: Gradient.radial([Color.alpha(VIOLET, 0.4), INK]) }),
+ full({ background: Gradient.radial([WHITE, FROST]) }),
blend(
Layer.vfx({
id: "finale-aurora",
effectType: "Aurora",
width: W,
height: H,
- colorStart: VIOLET,
- colorEnd: CYAN,
+ colorStart: SKY,
+ colorEnd: SIGNAL,
density: 0.65,
speed: 1.4,
intensity: 0.7,
}),
- "screen",
- ),
+ "multiply",
+ ).animate(keys("opacity", [[0, 0.3]])),
vortex,
- // A dark halo keeps the mark and the name readable over the vortex.
+ // A white halo keeps the lockup clean over the vortex.
Layer.shape("ellipse", {
id: "finale-halo",
position: "absolute",
- x: CX - 700,
- y: CY - 380,
- width: 1400,
- height: 860,
+ x: CX - 760,
+ y: CY - 360,
+ width: 1520,
+ height: 820,
fillColor: Gradient.radial([
- Color.alpha(INK, 0.85),
- Color.alpha(INK, 0),
+ Color.alpha(WHITE, 0.95),
+ Color.alpha(WHITE, 0),
]),
}),
...fireworks,
...orbit,
+ // The brand lockup (assets/brand/logo-wordmark-light.svg): mark and name.
Layer.box({
- id: "finale-mark",
+ id: "finale-lockup",
position: "absolute",
- x: CX - logo / 2,
- y: CY - logo / 2 - 120,
- width: logo,
- height: logo,
+ x: CX - 1060 / 2,
+ y: CY - 210 / 2 - 40,
+ width: 1060,
+ height: 210,
children: [
- Layer.image(LOGO, {
- id: "finale-logo",
+ Layer.svg(WORDMARK, {
+ id: "finale-wordmark",
position: "absolute",
x: 0,
y: 0,
- width: logo,
- height: logo,
+ width: 1060,
+ height: 210,
fit: "contain",
})
.withEffect(
new LayerStyle({
outerGlow: {
enabled: true,
- color: CYAN,
- opacity: 0.8,
- size: 50,
+ color: SKY,
+ opacity: 0.6,
+ size: 40,
spread: 0,
},
}),
)
- .animate(popIn(4, 22, 0)),
+ .animate(popIn(4, 22, 0.3)),
],
}).animate(
LayerAnimation.create().signal("scale", kick, {
- multiplier: 0.06,
+ multiplier: 0.03,
offset: 1,
}),
keys("rotation", [
[hit - 1, 0],
- [hit, -6],
+ [hit, -3],
[hit + 20, 0, "elastic.out(1, 0.4)"],
]),
),
- Layer.box({
- id: "finale-name",
- position: "absolute",
- x: CX - nw / 2,
- y: CY + 30,
- width: nw,
- height: 190,
- children: [
- Layer.image(nameGlow, {
- id: "finale-name-img",
- position: "absolute",
- x: 0,
- y: 0,
- width: nw,
- height: 190,
- }).withEffect(
- new LayerStyle({
- outerGlow: {
- enabled: true,
- color: PINK,
- opacity: 0.55,
- size: 40,
- spread: 0,
- },
- }),
- ),
- ],
- }).animate(
- keys("opacity", [
- [0, 0],
- [16, 0],
- [24, 1],
- ]),
- keys("y", [
- [16, CY + 90],
- [36, CY + 30, "expo.out"],
- ]),
- ),
Layer.box({
id: "finale-install",
position: "absolute",
x: CX - 250,
- y: CY + 240,
+ y: CY + 150,
width: 500,
height: 74,
borderRadius: 37,
- background: Color.alpha("#ffffff", 0.08),
- borderColor: Color.alpha("#ffffff", 0.25),
+ background: WHITE,
+ borderColor: LINE,
borderWidth: 1.5,
children: [
Layer.text("$ npm i framefields", {
@@ -302,7 +250,7 @@ export async function finaleScene(): Promise<Node> {
align: "center",
fontFamily: MONO,
fontSize: 30,
- fill: GOLD,
+ fill: COBALT,
}).animate(LayerAnimation.create().typewriter(40, 64, "linear")),
],
}).animate(popIn(34, 16, 0.6)),
@@ -326,10 +274,15 @@ export async function finaleScene(): Promise<Node> {
[BAR + 20, 1],
]),
),
- full({ id: "finale-hit", background: PAPER, opacity: 0 }).animate(
+ full({
+ id: "finale-hit",
+ background: SKY,
+ opacity: 0,
+ blendMode: "multiply",
+ }).animate(
keys("opacity", [
[hit - 1, 0],
- [hit, 0.9],
+ [hit, 0.5],
[hit + 12, 0, "power2.out"],
]),
),
@@ -346,7 +299,7 @@ export async function finaleScene(): Promise<Node> {
]),
);
- return scene("finale", "#000000", [
+ return scene("finale", NIGHT, [
stage,
Layer.shape("ellipse", {
id: "finale-dot",
@@ -368,7 +321,7 @@ export async function finaleScene(): Promise<Node> {
[off + 16, 0.05, "power2.in"],
]),
),
- full({ id: "finale-end", background: "#000000", opacity: 0 }).animate(
+ full({ id: "finale-end", background: NIGHT, opacity: 0 }).animate(
keys("opacity", [
[off + 14, 0],
[off + 15, 1],
diff --git a/examples/29_capabilities_reel/src/scenes/fluid.ts b/examples/29_capabilities_reel/src/scenes/fluid.ts
index 186d9555..6ea4cfd5 100644
--- a/examples/29_capabilities_reel/src/scenes/fluid.ts
+++ b/examples/29_capabilities_reel/src/scenes/fluid.ts
@@ -18,21 +18,28 @@ import { full, hud, keys, type Node, popIn, scene } from "../kit.js";
import { lowpassAt } from "../music.js";
import { still } from "../precomp.js";
import {
+ BG,
+ COBALT,
CYAN,
DISPLAY,
EMBER,
+ FG,
GOLD,
INK,
- LIME,
+ LINE,
MONO,
MUTED,
+ NIGHT,
PAPER,
PINK,
+ SIGNAL,
+ SKY,
VIOLET,
+ WHITE,
} from "../theme.js";
import { chapter } from "../timeline.js";
-const PANEL = { r: 28, bg: "#0B0A16", border: Color.alpha("#ffffff", 0.1) };
+const PANEL = { r: 28, bg: NIGHT, border: Color.alpha("#ffffff", 0.12) };
function panel(
id: string,
@@ -136,7 +143,7 @@ export async function fluidScene(): Promise<Node> {
fade: [0, 0.5],
shape: "soft",
blend: "add",
- color: [GOLD, EMBER, PINK],
+ color: [WHITE, SKY, SIGNAL],
} as never).withEffect(
new Trails({
decay: 0.96,
@@ -240,9 +247,9 @@ export async function fluidScene(): Promise<Node> {
markerKeys.push([f, Math.round(u * ew) - 9, "none"]);
}
- return scene("fluid", "#06060D", [
+ return scene("fluid", BG, [
full({
- background: Gradient.radial([Color.alpha(VIOLET, 0.22), "transparent"]),
+ background: Gradient.radial([Color.alpha(SKY, 0.3), "transparent"]),
}),
Layer.text("Warp, melt, echo", {
id: "fluid-title",
@@ -253,7 +260,7 @@ export async function fluidScene(): Promise<Node> {
fontWeight: 800,
fontSize: 76,
letterSpacing: -2,
- fill: PAPER,
+ fill: FG,
}).animate(
keys("opacity", [
[0, 0],
@@ -291,7 +298,7 @@ export async function fluidScene(): Promise<Node> {
y: eh * 0.25,
width: ew,
height: 1,
- background: Color.alpha("#ffffff", 0.15),
+ background: LINE,
}),
Layer.shape("path", {
id: "fluid-eq-curve",
@@ -303,7 +310,7 @@ export async function fluidScene(): Promise<Node> {
d: eqKeys[0][1],
fillType: "none",
fillColor: "transparent",
- strokeColor: LIME,
+ strokeColor: COBALT,
strokeWidth: 4,
}).animate(keys("d", eqKeys)),
// At the cutoff the response is -3 dB, so the marker rides at that height.
@@ -316,7 +323,7 @@ export async function fluidScene(): Promise<Node> {
9,
width: 18,
height: 18,
- fillColor: LIME,
+ fillColor: COBALT,
}).animate(keys("x", markerKeys)),
Layer.text(
"the low-pass on the music right now: AudioParametricEq({ frequency: signal })",
@@ -340,7 +347,7 @@ export async function fluidScene(): Promise<Node> {
[40, 1],
]),
),
- full({ id: "fluid-dim", background: INK, opacity: 0 }).animate(
+ full({ id: "fluid-dim", background: BG, opacity: 0 }).animate(
keys("opacity", [
[c.frames - 4, 0],
[c.frames, 0.6],
diff --git a/examples/29_capabilities_reel/src/scenes/lottie.ts b/examples/29_capabilities_reel/src/scenes/lottie.ts
index 37017857..af963765 100644
--- a/examples/29_capabilities_reel/src/scenes/lottie.ts
+++ b/examples/29_capabilities_reel/src/scenes/lottie.ts
@@ -2,20 +2,24 @@
* 02 — Lottie. Eight animations, each on its own card, flip in on the beat; on the third bar the
* whole wall tips back in perspective while an abstract Lottie plays full-frame behind it.
*/
-import { Blur, Color, Layer, LayerAnimation, LayerStyle } from "framefields";
-import { full, hud, keys, type Node, scene } from "../kit.js";
+import { Blur, Color, Layer, LayerAnimation } from "framefields";
+import { brandTint, full, hud, keys, type Node, scene } from "../kit.js";
import { kick } from "../music.js";
import { lottie } from "../paths.js";
import {
BAR,
BEAT,
+ BG,
CYAN,
DISPLAY,
+ FG,
GOLD,
H,
LIME,
+ LINE,
MONO,
MUTED,
+ NAVY,
NIGHT,
PAPER,
PINK,
@@ -33,7 +37,7 @@ const CARDS: Array<{
{
name: "fireworks",
label: "fireworks",
- bg: "#120E24",
+ bg: NIGHT,
fit: "cover",
pad: 0,
},
@@ -50,7 +54,7 @@ const CARDS: Array<{
{
name: "happy2016",
label: "happy2016",
- bg: "#030B26",
+ bg: NIGHT,
fit: "cover",
pad: 0,
},
@@ -71,62 +75,73 @@ export function lottieScene(): Node {
const row = Math.floor(i / COLS);
const pad = card.pad ?? 26;
const at = 6 + i * 5;
+ const x = X0 + col * (CW + GAP);
+ const y = Y0 + row * (CH + GAP + 34);
+ // Box layers take no effects, so elevation is two soft navy plates under the card.
+ const plate = (dy: number, alpha: number, grow: number) =>
+ Layer.box({
+ position: "absolute",
+ x: -grow,
+ y: dy - grow,
+ width: CW + grow * 2,
+ height: CH + grow * 2,
+ borderRadius: 26 + grow,
+ background: Color.alpha(NAVY, alpha),
+ });
return Layer.box({
id: `lottie-card-${card.name}`,
position: "absolute",
- x: X0 + col * (CW + GAP),
- y: Y0 + row * (CH + GAP + 34),
+ x,
+ y,
width: CW,
height: CH,
- borderRadius: 26,
- background: card.bg,
- borderColor: Color.alpha("#ffffff", 0.16),
- borderWidth: 1.5,
- overflow: "hidden",
transformStyle: "preserve-3d",
perspective: 1100,
children: [
- Layer.lottie(lottie(card.name), {
- id: `lottie-${card.name}`,
+ plate(18, 0.05, 10),
+ plate(8, 0.07, 3),
+ Layer.box({
+ id: `lottie-face-${card.name}`,
position: "absolute",
- x: pad,
- y: pad,
- width: CW - pad * 2,
- height: CH - pad * 2,
- fit: card.fit ?? "contain",
+ x: 0,
+ y: 0,
+ width: CW,
+ height: CH,
+ borderRadius: 26,
+ background: card.bg,
+ borderColor: LINE,
+ borderWidth: 1.5,
+ overflow: "hidden",
+ children: [
+ Layer.lottie(lottie(card.name), {
+ id: `lottie-${card.name}`,
+ position: "absolute",
+ x: pad,
+ y: pad,
+ width: CW - pad * 2,
+ height: CH - pad * 2,
+ fit: card.fit ?? "contain",
+ }),
+ ],
}),
],
- })
- .animate(
- keys("rotateY", [
- [0, -95],
- [at, -95],
- [at + 22, 0, "expo.out"],
- ]),
- keys("opacity", [
- [0, 0],
- [at, 0],
- [at + 4, 1],
- ]),
- keys("scale", [
- [0, 0.7],
- [at, 0.7],
- [at + 22, 1, "back.out(1.4)"],
- ]),
- )
- .withEffect(
- new LayerStyle({
- dropShadow: {
- enabled: true,
- color: "#000000",
- opacity: 0.55,
- angle: 90,
- distance: 18,
- spread: 0,
- size: 34,
- },
- }),
- );
+ }).animate(
+ keys("rotateY", [
+ [0, -95],
+ [at, -95],
+ [at + 22, 0, "expo.out"],
+ ]),
+ keys("opacity", [
+ [0, 0],
+ [at, 0],
+ [at + 4, 1],
+ ]),
+ keys("scale", [
+ [0, 0.7],
+ [at, 0.7],
+ [at + 22, 1, "back.out(1.4)"],
+ ]),
+ );
});
const labels = CARDS.map((card, i) =>
Layer.text(`${String(i + 1).padStart(2, "0")} ${card.label}.json`, {
@@ -147,7 +162,7 @@ export function lottieScene(): Node {
),
);
- return scene("lottie", NIGHT, [
+ return scene("lottie", BG, [
// Full-frame abstract Lottie, blurred into a moving backdrop.
Layer.lottie(lottie("gradientShapes"), {
id: "lottie-backdrop",
@@ -158,15 +173,18 @@ export function lottieScene(): Node {
height: H,
fit: "cover",
})
- .withEffect(new Blur({ blurType: "Gaussian", strength: 40 }))
+ .withEffects([
+ brandTint(),
+ new Blur({ blurType: "Gaussian", strength: 40 }),
+ ])
.animate(
keys("opacity", [
[0, 0],
- [BAR, 0.45, "sine.inOut"],
+ [BAR, 0.3, "sine.inOut"],
]),
),
full({
- background: `linear-gradient(180deg, ${NIGHT}00 0%, ${NIGHT} 92%)`,
+ background: `linear-gradient(180deg, ${BG}00 0%, ${BG} 92%)`,
}),
Layer.text("Lottie", {
id: "lottie-title",
@@ -177,7 +195,7 @@ export function lottieScene(): Node {
fontWeight: 800,
fontSize: 96,
letterSpacing: -2,
- fill: PAPER,
+ fill: FG,
}).animate(
keys("x", [
[0, X0 - 60],
@@ -250,7 +268,7 @@ export function lottieScene(): Node {
"Layer.lottie",
"fit: cover | contain",
"rotateY · perspective",
- "LayerStyle.dropShadow",
+ "3D card flips",
"Blur",
]),
]);
diff --git a/examples/29_capabilities_reel/src/scenes/open.ts b/examples/29_capabilities_reel/src/scenes/open.ts
index 61169601..47233707 100644
--- a/examples/29_capabilities_reel/src/scenes/open.ts
+++ b/examples/29_capabilities_reel/src/scenes/open.ts
@@ -22,19 +22,22 @@ import { still } from "../precomp.js";
import {
BAR,
BEAT,
+ BG,
CYAN,
DISPLAY,
EMBER,
+ FG,
+ FROST,
GOLD,
H,
- INK,
MUTED,
- PAPER,
PINK,
- PLUM,
- SERIF,
- VIOLET,
+ ROYAL,
+ SANS,
+ SIGNAL,
+ SKY,
W,
+ WHITE,
} from "../theme.js";
import { chapter } from "../timeline.js";
@@ -42,7 +45,7 @@ const TITLE = {
fontFamily: DISPLAY,
fontWeight: 800,
fontSize: 210,
- letterSpacing: -6,
+ letterSpacing: -9,
};
const POPS: Array<[NotoName, number, number, number]> = [
["sparkles", 250, 300, 150],
@@ -77,7 +80,7 @@ export async function openScene(): Promise<Node> {
width: tw,
height: th,
...TITLE,
- fill: PAPER,
+ fill: FG,
align: "center",
}),
]);
@@ -85,7 +88,7 @@ export async function openScene(): Promise<Node> {
const ty = 470;
const split = Signal.programmatic((ctx) => {
const t = (ctx.frame - c.start - (c.frames - BEAT * 2)) / (BEAT * 2);
- return t <= 0 ? 0 : 3 + 22 * t * t;
+ return t <= 0 ? 0 : 2 + 10 * t * t;
});
// A shockwave out of the flame on every kick of the drop bar.
@@ -123,8 +126,8 @@ export async function openScene(): Promise<Node> {
);
});
- return scene("open", INK, [
- full({ background: Gradient.radial([PLUM, INK]) }).animate(
+ return scene("open", BG, [
+ full({ background: Gradient.radial([WHITE, FROST]) }).animate(
keys("opacity", [
[0, 0],
[BAR, 1, "sine.inOut"],
@@ -137,18 +140,18 @@ export async function openScene(): Promise<Node> {
effectType: "Aurora",
width: W,
height: H,
- colorStart: VIOLET,
- colorEnd: CYAN,
+ colorStart: SKY,
+ colorEnd: SIGNAL,
density: 0.7,
speed: 1.2,
intensity: 0.8,
}),
- "screen",
+ "multiply",
).animate(
keys("opacity", [
[0, 0],
[drop - 6, 0],
- [drop + 10, 0.7, "power2.out"],
+ [drop + 10, 0.35, "power2.out"],
]),
),
blend(
@@ -160,11 +163,11 @@ export async function openScene(): Promise<Node> {
density: 0.9,
speed: 0.9,
intensity: 1,
- colorStart: GOLD,
- colorEnd: EMBER,
+ colorStart: SKY,
+ colorEnd: SIGNAL,
seed: 11,
}),
- "screen",
+ "normal",
).animate(
keys("opacity", [
[0, 0],
@@ -197,8 +200,8 @@ export async function openScene(): Promise<Node> {
sizeJitter: 0.6,
fade: [0.05, 0.4],
shape: "spark",
- blend: "add",
- color: ["#FFF3C4", GOLD, EMBER, "#7A2E14"],
+ blend: "normal",
+ color: [SKY, SIGNAL, EMBER, ROYAL],
} as never),
...rings,
Layer.box({
@@ -221,8 +224,8 @@ export async function openScene(): Promise<Node> {
new LayerStyle({
outerGlow: {
enabled: true,
- color: EMBER,
- opacity: 0.85,
+ color: SKY,
+ opacity: 0.7,
size: 70,
spread: 0,
},
@@ -274,9 +277,9 @@ export async function openScene(): Promise<Node> {
new LayerStyle({
outerGlow: {
enabled: true,
- color: EMBER,
- opacity: 0.7,
- size: 46,
+ color: SKY,
+ opacity: 1,
+ size: 50,
spread: 0,
},
}),
@@ -296,7 +299,7 @@ export async function openScene(): Promise<Node> {
width: tw,
height: th,
...TITLE,
- fill: PAPER,
+ fill: FG,
align: "center",
animators: [
TextAnimator.waveRise({
@@ -334,9 +337,9 @@ export async function openScene(): Promise<Node> {
x: 0,
y: 728,
width: W,
- fontFamily: SERIF,
- fontStyle: "italic",
- fontSize: 50,
+ fontFamily: SANS,
+ fontWeight: 500,
+ fontSize: 44,
fill: MUTED,
align: "center",
animators: [TextAnimator.blurIn({ unit: "word", blur: 18, y: 18 })],
diff --git a/examples/29_capabilities_reel/src/scenes/space.ts b/examples/29_capabilities_reel/src/scenes/space.ts
index 00277362..8aef0e2b 100644
--- a/examples/29_capabilities_reel/src/scenes/space.ts
+++ b/examples/29_capabilities_reel/src/scenes/space.ts
@@ -16,15 +16,22 @@ import { full, hud, keys, type Node, scene } from "../kit.js";
import { kick } from "../music.js";
import { lottie } from "../paths.js";
import {
+ BG,
+ COBALT,
CYAN,
DISPLAY,
EMBER,
+ FROST,
GOLD,
H,
LIME,
+ NIGHT,
PINK,
+ SIGNAL,
+ SKY,
VIOLET,
W,
+ WHITE,
} from "../theme.js";
import { chapter } from "../timeline.js";
@@ -78,8 +85,8 @@ export function spaceScene(): Node {
emissiveIntensity: 4,
}).animate(
LayerAnimation.create().signal("emissiveIntensity", kick, {
- multiplier: 6,
- offset: 3,
+ multiplier: 3,
+ offset: 2,
}),
);
});
@@ -98,8 +105,8 @@ export function spaceScene(): Node {
x: CX,
y: CY - 40,
z: 0,
- fill: "#FFE3B8",
- metallic: 0.35,
+ fill: COBALT,
+ metallic: 0.2,
roughness: 0.3,
}),
Layer3D.sphere({
@@ -132,9 +139,9 @@ export function spaceScene(): Node {
front: card("dogCar", "#4FC3C9", 230),
back: card("gatin", "#1D6EAF", 230),
left: card("growth", "#E9E4F7", 230),
- right: card("fireworks", "#120E24", 230),
- top: card("squares", "#2A2A2A", 230),
- bottom: card("happy2016", "#030B26", 230),
+ right: card("fireworks", NIGHT, 230),
+ top: card("squares", NIGHT, 230),
+ bottom: card("happy2016", NIGHT, 230),
},
} as never).animate(
keys("rotateY", [
@@ -148,22 +155,23 @@ export function spaceScene(): Node {
),
Layer.carousel3d({
id: "space-carousel",
- radius: 1050,
+ radius: 900,
+ rotateX: 14,
x: CX,
- y: CY - 20,
+ y: CY + 30,
z: 0,
- itemWidth: 300,
- itemHeight: 216,
+ itemWidth: 260,
+ itemHeight: 188,
twoSided: true,
items: [
card("boat", "#ffffff"),
card("cactus", "#F4EFE6"),
card("navidad", "#FFC7D9"),
- card("bodymovin", "#2A1458"),
- card("gradientStrokes", "#120E24"),
+ card("bodymovin", NIGHT),
+ card("gradientStrokes", NIGHT),
card("pinJump", "#F4EFE6"),
- card("iconTransitions", "#0E1A2A"),
- card("adrock", "#3A1020"),
+ card("iconTransitions", NIGHT),
+ card("adrock", NIGHT),
],
} as never).animate(
keys("rotateY", [
@@ -175,9 +183,9 @@ export function spaceScene(): Node {
],
});
- return scene("space", "#05040A", [
+ return scene("space", BG, [
full({
- background: Gradient.radial([Color.alpha(VIOLET, 0.35), "#05040A"]),
+ background: Gradient.radial([WHITE, FROST]),
}),
Layer.particles({
id: "space-stars",
@@ -193,8 +201,8 @@ export function spaceScene(): Node {
sizeJitter: 0.8,
fade: [0.3, 0.3],
shape: "soft",
- blend: "add",
- color: ["#ffffff", "#b9c7ff"],
+ blend: "normal",
+ color: [Color.alpha(SIGNAL, 0.5), Color.alpha(SKY, 0.6)],
prewarm: 8,
} as never),
Layer.camera({
@@ -204,7 +212,7 @@ export function spaceScene(): Node {
targetZ: 0,
animation: cam,
} as never),
- ...(Lighting.dramatic({
+ ...(Lighting.studio({
target: [CX, CY, 0],
bloom: true,
exposure: 0.2,
@@ -212,7 +220,7 @@ export function spaceScene(): Node {
world,
hud("space", [
"CameraAnimation.orbit",
- "Lighting.dramatic + bloom",
+ "Lighting.studio + bloom",
"Layer3D.extrudedText",
"material: glass",
"Layer.cube(faces: Lottie)",
diff --git a/examples/29_capabilities_reel/src/scenes/stylize.ts b/examples/29_capabilities_reel/src/scenes/stylize.ts
index 957e4974..ef0d0ed5 100644
--- a/examples/29_capabilities_reel/src/scenes/stylize.ts
+++ b/examples/29_capabilities_reel/src/scenes/stylize.ts
@@ -7,7 +7,18 @@
import { Color, Layer, Signal, Styles } from "framefields";
import { full, hud, keys, type Node, popIn, scene } from "../kit.js";
import { DANCER, lottie, REPO } from "../paths.js";
-import { BAR, BEAT, DISPLAY, H, INK, MONO, PAPER, W } from "../theme.js";
+import {
+ BAR,
+ BEAT,
+ BG,
+ DISPLAY,
+ FG,
+ H,
+ INK,
+ MONO,
+ PAPER,
+ W,
+} from "../theme.js";
import { chapter } from "../timeline.js";
const PORTRAIT = `${REPO}/examples/19_framefields_film/assets/portrait.png`;
@@ -211,7 +222,7 @@ export function stylizeScene(): Node {
});
});
- return scene("stylize", INK, [
+ return scene("stylize", BG, [
Layer.text("One source. Every look.", {
id: "stylize-title",
position: "absolute",
@@ -221,7 +232,7 @@ export function stylizeScene(): Node {
fontWeight: 800,
fontSize: 70,
letterSpacing: -2,
- fill: PAPER,
+ fill: FG,
}).animate(
keys("opacity", [
[0, 0],
diff --git a/examples/29_capabilities_reel/src/scenes/type.ts b/examples/29_capabilities_reel/src/scenes/type.ts
index 84fc3c67..c28ae2f5 100644
--- a/examples/29_capabilities_reel/src/scenes/type.ts
+++ b/examples/29_capabilities_reel/src/scenes/type.ts
@@ -11,24 +11,25 @@ import {
TextAnimator,
TextPathBuilder,
} from "framefields";
-import { full, hud, keys, type Node, scene } from "../kit.js";
+import { brandTint, full, hud, keys, type Node, scene } from "../kit.js";
import { kick } from "../music.js";
import { lottie } from "../paths.js";
import {
ARABIC,
BAR,
BEAT,
- CYAN,
+ BG,
+ COBALT,
DISPLAY,
- GOLD,
+ FG,
H,
HEBREW,
- LIME,
MONO,
MUTED,
- PAPER,
- PINK,
- SERIF,
+ ROYAL,
+ SANS,
+ SIGNAL,
+ SKY,
VIOLET,
W,
} from "../theme.js";
@@ -70,7 +71,7 @@ export function typeScene(): Node {
fontWeight: 700,
fontSize: 26,
letterSpacing: 4,
- fill: Color.alpha(PAPER, 0.55),
+ fill: Color.alpha(FG, 0.45),
pathOptions: TextPathBuilder.circularBadge(R + 40, R + 40, R).build(),
} as never),
],
@@ -97,7 +98,7 @@ export function typeScene(): Node {
fontWeight: 800,
fontSize: 200,
letterSpacing: -6,
- fill: PAPER,
+ fill: FG,
animators: [TextAnimator.flip3D({ rotationX: 100 })],
}).animate(
LayerAnimation.create().kineticSweep(-1, 1, 4, 34, "power2.out"),
@@ -109,10 +110,10 @@ export function typeScene(): Node {
y: CY + 60,
width: W,
align: "center",
- fontFamily: SERIF,
- fontStyle: "italic",
+ fontFamily: SANS,
+ fontWeight: 600,
fontSize: 72,
- fill: GOLD,
+ fill: COBALT,
animators: [TextAnimator.waveRise({ y: 50, rotationX: 50, blur: 8 })],
}).animate(
LayerAnimation.create().kineticSweep(-1, 1, 18, 46, "power2.out"),
@@ -128,7 +129,7 @@ export function typeScene(): Node {
y: 0,
width: W,
height: H,
- background: `linear-gradient(120deg, ${VIOLET}, ${PINK} 50%, ${GOLD})`,
+ background: `linear-gradient(120deg, ${ROYAL}, ${SIGNAL} 50%, ${SKY})`,
children: [
Layer.lottie(lottie("gradientShapes"), {
id: "type-inside-lottie",
@@ -138,7 +139,7 @@ export function typeScene(): Node {
width: W,
height: H,
fit: "cover",
- }),
+ }).withEffect(brandTint()),
],
}).withMatte(
Layer.text("INSIDE", {
@@ -180,9 +181,9 @@ export function typeScene(): Node {
]);
const GREETINGS: Array<[string, string, string]> = [
- ["Hello", DISPLAY, CYAN],
- ["مرحبا", ARABIC, PINK],
- ["שלום", HEBREW, LIME],
+ ["Hello", DISPLAY, COBALT],
+ ["مرحبا", ARABIC, SIGNAL],
+ ["שלום", HEBREW, ROYAL],
];
const hello = phase("hello", BAR * 2, BAR + 30, [
...GREETINGS.map(([word, family, color], i) =>
@@ -229,9 +230,9 @@ export function typeScene(): Node {
),
]);
- return scene("type", "#0A0814", [
+ return scene("type", BG, [
full({
- background: `radial-gradient(circle, ${Color.alpha(VIOLET, 0.3)}, transparent 70%)`,
+ background: `radial-gradient(circle, ${Color.alpha(SKY, 0.35)}, transparent 70%)`,
}).animate(
LayerAnimation.create().signal("opacity", kick, {
multiplier: 0.5,
diff --git a/examples/29_capabilities_reel/src/scenes/vector.ts b/examples/29_capabilities_reel/src/scenes/vector.ts
index 6c16b334..16084eeb 100644
--- a/examples/29_capabilities_reel/src/scenes/vector.ts
+++ b/examples/29_capabilities_reel/src/scenes/vector.ts
@@ -23,15 +23,16 @@ import { kick } from "../music.js";
import { fluent, lucide } from "../paths.js";
import {
BEAT,
- CYAN,
+ BG,
+ COBALT,
DISPLAY,
- EMBER,
GOLD,
INK,
+ LIME,
MONO,
- PAPER,
- PINK,
- VIOLET,
+ ROYAL,
+ SIGNAL,
+ SKY,
} from "../theme.js";
import { chapter } from "../timeline.js";
@@ -95,7 +96,7 @@ export function vectorScene(): Node {
]),
keys("strokeColor", [
[at + 34, INK],
- [at + 44, [EMBER, VIOLET, CYAN, PINK, GOLD][i % 5], "power2.out"],
+ [at + 44, [COBALT, ROYAL, SIGNAL, GOLD, LIME][i % 5], "power2.out"],
]),
);
});
@@ -152,7 +153,7 @@ export function vectorScene(): Node {
);
});
- return scene("vector", PAPER, [
+ return scene("vector", BG, [
Layer.text("SVG, shapes", {
id: "vector-title",
position: "absolute",
@@ -182,7 +183,7 @@ export function vectorScene(): Node {
fontWeight: 800,
fontSize: 104,
letterSpacing: -3,
- fill: VIOLET,
+ fill: COBALT,
}).animate(
keys("opacity", [
[0, 0],
@@ -227,7 +228,7 @@ export function vectorScene(): Node {
width: MORPH,
height: MORPH,
d: shapes[0],
- fillColor: Gradient.linear([EMBER, PINK, VIOLET, CYAN], 135),
+ fillColor: Gradient.linear([SKY, SIGNAL, COBALT, ROYAL], 135),
strokeWidth: 0,
}).animate(
LayerAnimation.keys("d", morphKeys as never),
diff --git a/examples/29_capabilities_reel/src/scenes/vision.ts b/examples/29_capabilities_reel/src/scenes/vision.ts
index a13d3f50..22ff22a7 100644
--- a/examples/29_capabilities_reel/src/scenes/vision.ts
+++ b/examples/29_capabilities_reel/src/scenes/vision.ts
@@ -13,7 +13,17 @@ import {
} from "framefields";
import { full, hud, keys, type Node, scene } from "../kit.js";
import { DANCER, emoji } from "../paths.js";
-import { DISPLAY, EMBER, GOLD, H, MONO, PAPER, VIOLET, W } from "../theme.js";
+import {
+ COBALT,
+ DISPLAY,
+ EMBER,
+ GOLD,
+ H,
+ MONO,
+ NAVY,
+ PAPER,
+ W,
+} from "../theme.js";
import { chapter } from "../timeline.js";
export async function visionScene(comp: Composition): Promise<Node> {
@@ -56,7 +66,7 @@ export async function visionScene(comp: Composition): Promise<Node> {
size: [10, 6],
sizeJitter: 0.6,
fade: [0.15, 0.3],
- color: ["#7A2E14", EMBER, GOLD, "#FFE7B0"],
+ color: [NAVY, EMBER, GOLD, "#DBEAFE"],
colorBySpeed: 500,
prewarm: 3,
} as never);
@@ -104,7 +114,7 @@ export async function visionScene(comp: Composition): Promise<Node> {
fontWeight: 800,
fontSize: 360,
letterSpacing: -14,
- fill: Color.alpha(VIOLET, 0.92),
+ fill: Color.alpha(COBALT, 0.94),
}).animate(
keys("scale", [
[0, 1.3],
@@ -128,7 +138,7 @@ export async function visionScene(comp: Composition): Promise<Node> {
y: 70,
fontFamily: MONO,
fontSize: 20,
- fill: Color.alpha("#1E1512", 0.75),
+ fill: Color.alpha(NAVY, 0.8),
},
).animate(
keys("opacity", [
diff --git a/examples/29_capabilities_reel/src/score.ts b/examples/29_capabilities_reel/src/score.ts
index b8934eec..83308da0 100644
--- a/examples/29_capabilities_reel/src/score.ts
+++ b/examples/29_capabilities_reel/src/score.ts
@@ -1,5 +1,5 @@
/**
- * pnpm score → assets/stems/{drums,bass,music,fx}.wav
+ * pnpm score → assets/stems/{drums,bass,music}.wav (transition effects are Freesound files, see SFX)
*
* A small deterministic synthesizer renders music.ts's arrangement (120 BPM, A minor) into four
* stems. The film mixes them with framefields' audio nodes (compressor, EQ sweep, delay, reverb,
@@ -11,10 +11,8 @@ import {
beatToFrame,
CLAPS,
HATS,
- IMPACTS,
KICKS,
PROGRESSION,
- RISERS,
SAMPLE_RATE,
SECONDS_PER_BEAT,
sectionAt,
@@ -180,48 +178,11 @@ function padChord(tones: number[], dur: number, bright: number): Stereo {
return out;
}
-function riser(dur: number): Float32Array {
- const n = Math.round(dur * SR);
- const out = new Float32Array(n);
- let bp1 = 0;
- let bp2 = 0;
- let ph = 0;
- for (let i = 0; i < n; i++) {
- const t = i / SR;
- const k = t / dur;
- const fc = 300 * 30 ** k;
- const f = 2 * Math.sin((Math.PI * Math.min(fc, 12000)) / SR);
- const x = noise();
- bp1 += f * (x - bp1 - 0.35 * bp2);
- bp2 += f * bp1;
- ph += (TAU * (220 * 4 ** k)) / SR;
- out[i] = (bp1 * 0.5 + Math.sin(ph) * 0.12) * k ** 2;
- }
- return out;
-}
-
-function boom(): Float32Array {
- const n = Math.round(2.4 * SR);
- const out = new Float32Array(n);
- let ph = 0;
- let lp = 0;
- for (let i = 0; i < n; i++) {
- const t = i / SR;
- ph += (TAU * (38 + 60 * Math.exp(-t * 6))) / SR;
- const low = Math.sin(ph) * Math.exp(-t * 2.2);
- lp += 0.08 * (noise() - lp);
- const crash = (noise() - lp) * Math.exp(-t * 2.8) * 0.4;
- out[i] = Math.tanh((low + crash) * 1.3) * 0.9;
- }
- return out;
-}
-
// ── Arrangement ─────────────────────────────────────────────────────────────
const drums = stem();
const bass = stem();
const music = stem();
-const fx = stem();
const K = kickVoice();
const C = clapVoice();
@@ -315,11 +276,6 @@ for (let i = 0; i < LENGTH; i++) {
music[1][i] *= 0.55 + 0.45 * g;
}
-const R = riser(SECONDS_PER_BEAT * 4);
-for (const bar of RISERS) add(fx, beatSec(bar * 4), R, 0.6);
-const B = boom();
-for (const b of IMPACTS) add(fx, beatSec(b), B, 0.8);
-
// ── Write ───────────────────────────────────────────────────────────────────
function wav(data: Stereo, peak: number): Buffer {
@@ -361,7 +317,6 @@ const stems: Record<string, [Stereo, number]> = {
drums: [drums, 0.7],
bass: [bass, 0.5],
music: [music, 0.42],
- fx: [fx, 0.5],
};
for (const [name, [data, peak]] of Object.entries(stems)) {
const file = path.join(dir, `${name}.wav`);
diff --git a/examples/29_capabilities_reel/src/theme.ts b/examples/29_capabilities_reel/src/theme.ts
index ea7b0572..8d6b99fd 100644
--- a/examples/29_capabilities_reel/src/theme.ts
+++ b/examples/29_capabilities_reel/src/theme.ts
@@ -13,32 +13,49 @@ export const BAR = BEAT * 4;
export const beats = (n: number) => Math.round(n * BEAT);
export const bars = (n: number) => Math.round(n * BAR);
-// Palette: a near-black ink stage with an electric spectrum of accents.
-export const INK = "#07060B";
-export const NIGHT = "#0E0C18";
-export const PLUM = "#1A1230";
-export const PAPER = "#F4EFE6";
-export const MUTED = "#9C96B0";
-export const EMBER = "#FF5A1F";
-export const GOLD = "#FFC93C";
-export const LIME = "#B8FF3C";
-export const CYAN = "#2EE6FF";
-export const VIOLET = "#7A4DFF";
-export const PINK = "#FF3D9A";
-export const SPECTRUM = [EMBER, GOLD, LIME, CYAN, VIOLET, PINK];
-
-export const DISPLAY = "Syne";
+// The framefields brand (framefields-social/packages/brand), light theme: ice and white
+// grounds, navy type, the mark's signal blue and cobalt for emphasis, sky for glow. Night is
+// kept for "screens": panels that need a dark ground for their effect.
+export const NIGHT = "#081638";
+export const NAVY = "#0B1E4D";
+export const ROYAL = "#123A9C";
+export const COBALT = "#1D4ED8";
+export const SIGNAL = "#3B82F6";
+export const SKY = "#7DD3FC";
+export const ICE = "#F5F8FF";
+export const FROST = "#E6EEFC";
+export const LINE = "#D3DEF5";
+export const WHITE = "#FFFFFF";
+export const SLATE = "#5B6B91";
+
+/** Page ground, body type, secondary type. */
+export const BG = ICE;
+export const FG = NAVY;
+export const MUTED = SLATE;
+
+// Accent names the scenes use, mapped onto the brand's blues.
+export const EMBER = COBALT;
+export const GOLD = "#60A5FA";
+export const LIME = "#38BDF8";
+export const CYAN = SKY;
+export const VIOLET = ROYAL;
+export const PINK = SIGNAL;
+export const SPECTRUM = [COBALT, SIGNAL, GOLD, LIME, SKY, ROYAL];
+
+/** Ink on light grounds, and white for type on night panels and footage. */
+export const INK = NAVY;
+export const PAPER = WHITE;
+
+// Inter speaks, JetBrains Mono writes code.
+export const DISPLAY = "Inter";
export const SANS = "Inter";
export const MONO = "JetBrainsMono";
-export const SERIF = "InstrumentSerif";
export const ARABIC = "NotoSansArabic";
export const HEBREW = "NotoSansHebrew";
const FACES: Array<[string, string]> = [
- [DISPLAY, "Syne.ttf"],
[SANS, "Inter.ttf"],
[MONO, "JetBrainsMono.ttf"],
- [SERIF, "InstrumentSerif-Italic.ttf"],
[ARABIC, "NotoSansArabic.ttf"],
[HEBREW, "NotoSansHebrew.ttf"],
];