A toolbox of film styles made in code for Claude Code: 66 ready to use, and your own. Each style is a style prompt plus a demo film made entirely in code by Claude Opus 5.5, with no video model. By Lemomo. · 一套用代码做片的风格工具箱:66 种现成风格,也能做出你自己的
JavaScript agent-skillsai-agentsai-short-filmai-videoanimationcanvasclaudeclaude-codeclaude-code-pluginclaude-code-skillcreative-codingffmpegfilmmakingmotion-graphicsopus-5-5prompt-librarytext-to-speechthreejsvideo-productionwebgl
// Swiss typography look (learned from swiss-motion: 12-column grid, a single type family, flush left / ragged right, black and white + one signal red, generous white space, no shadows/grain) — a simplified version written from scratch
const TAU = Math.PI * 2;
export const SW = { page: '#eae9e5', paper: '#ffffff', ink: '#111111', red: '#e30613', grid: '#cfcec9' };
export const GRID = { cols: 12, m: 96, gut: 24, col: (1920 - 96 * 2 - 24 * 11) / 12 };
export const colX = i => GRID.m + i * (GRID.col + GRID.gut);
export function page(g, o = {}) {
g.fillStyle = SW.page; g.fillRect(0, 0, 1920, 1080);
if (o.grid !== false) {
g.save(); g.strokeStyle = SW.grid; g.lineWidth = 1;
for (let i = 0; i < 12; i++) { const x = colX(i); g.strokeRect(x + .5, 60.5, GRID.col, 960); }
for (let y = 60; y <= 1020; y += 24) { g.globalAlpha = .35; g.beginPath(); g.moveTo(GRID.m, y + .5); g.lineTo(1920 - GRID.m, y + .5); g.stroke(); }
g.restore();
}
}
export function text(g, t, x, y, size, w = 700, col = SW.ink, o = {}) {
g.save(); g.font = `${w} ${size}px Inter`; g.fillStyle = col; g.textAlign = o.align || 'left'; g.textBaseline = o.base || 'alphabetic';
g.letterSpacing = (size >= 90 ? -size * .03 : 0) + 'px'; g.fillText(t, x, y); g.restore();
}
// ───────── Swiss Dot: black circle (helmet) + black rectangle (body) + red circle (antenna ball); arm = saluting arm angle (radians, 0 = hanging down)─────────
// (x,y) = centre of the body's bottom edge, u = module unit (px)
export function cadetSwiss(g, x, y, u = 40, o = {}) {
const arm = o.arm ?? 0, ball = o.ball, show = o.ballShow ?? true;
g.save(); g.translate(x, y);
g.fillStyle = SW.ink;
g.fillRect(-2 * u, -5 * u, 4 * u, 5 * u); // body: 4×5 modules
g.beginPath(); g.arc(0, -7.5 * u, 2.5 * u, 0, TAU); g.fill(); // helmet: 5 modules in diameter
const lk = o.look ?? 1; // 1 = facing right, -1 = facing left
g.fillStyle = SW.page; g.beginPath(); g.arc(.6 * u * lk, -7.3 * u, 1.35 * u, 0, TAU); g.fill(); // visor: paper-coloured circle (its offset = facing direction)
g.fillStyle = SW.ink; g.beginPath(); g.arc(1.05 * u * lk, -7.4 * u, .28 * u, 0, TAU); g.fill(); // one eye
// antenna: thin line + red circle
const aw = o.antBend || 0;
g.save(); g.translate(0, -10 * u); g.rotate(aw); g.fillRect(-.06 * u, -1.5 * u, .12 * u, 1.5 * u); g.restore();
if (show) { g.fillStyle = SW.red; g.beginPath(); const [bx, by] = ball || [0, -12.2 * u]; g.arc(bx, by, .75 * u, 0, TAU); g.fill(); }
// arm: one rectangle rotating around the shoulder point
g.save(); g.translate(1.6 * u, -4.4 * u); g.rotate(-arm); g.fillStyle = SW.ink; g.fillRect(-.45 * u, 0, .9 * u, (o.armLen ?? 3.6) * u); g.restore();
// legs: two short rectangles
g.fillStyle = SW.ink; g.fillRect(-1.6 * u, 0, 1.1 * u, 1.6 * u); g.fillRect(.5 * u, 0, 1.1 * u, 1.6 * u);
// 05: white numerals over the body
text(g, '05', -1.6 * u, -1.3 * u, 1.5 * u, 800, SW.paper);
g.restore();
}
export function testCadet(g, t) {
page(g);
text(g, 'salute.', colX(0), 300, 200, 800);
text(g, 'cadet 05 — rule 7: arm 90°, hand to brow', colX(0), 360, 26, 500);
cadetSwiss(g, colX(8) + GRID.col / 2, 900, 44, { arm: 1.3 });
}
// ───────── G7 SALUTE! (local lt 0..3.43, 140 BPM, 8 beats: beats 4–6 are the instant replay)─────────
import { clamp as _c, seg as _seg, eo as _eo, ei as _ei, ss as _ss, lerp as _l, back as _back } from '/core/lib.js';
const B7 = 60 / 140;
export const SAL = { swing: 2 * B7, hit: 3 * B7, rep0: 4 * B7, rep1: 6 * B7, fail: 7 * B7 };
export const BOUNCE = [.217, .427]; // relative to the hit: two bounces (aligned with the woodblock in the score)
export const live7 = t => t < SAL.rep0 ? t : t < SAL.rep1 ? SAL.rep0 : t - (SAL.rep1 - SAL.rep0);
const U = 56, DX = colX(8) + 60, DY = 930; // Dot's position (columns 9–10 on the right, baseline 900)
const SH = [DX + 1.6 * U, DY - 4.4 * U], BALL0 = [DX, DY - 12.2 * U];
const A_HIT = Math.PI + Math.atan2(1.6, 7.8), L_HIT = Math.hypot(1.6, 7.8);
function armAt(tau) { // tau = time relative to the hit
const u = _c((tau + (SAL.hit - SAL.swing)) / (SAL.hit - SAL.swing));
if (tau < 0) return [A_HIT * _eo(u) * (u < 1 ? 1 : 1), 3.6 + (L_HIT - 3.6) * _ei(_seg(u, .45, 1))];
const k = Math.exp(-tau * 7); return [A_HIT + .15 * Math.sin(tau * 26) * k + .08 * (1 - k), L_HIT - (L_HIT - 3.6) * _eo(_seg(tau, .1, .5))];
}
// Red ball path (scripted parabola): flies up-left → lands on the baseline and bounces twice → rolls along the baseline out of the left edge
function ballAt(tau) {
const R = .75 * U, floor = DY - R;
if (tau <= 0) return [BALL0[0], BALL0[1], 0];
const segs = [[0, BOUNCE[0], BALL0, [1080, floor], 200], [BOUNCE[0], BOUNCE[1], [1080, floor], [880, floor], 110]];
for (const [t0, t1, a, b, h] of segs) if (tau < t1) { const u = (tau - t0) / (t1 - t0); return [_l(a[0], b[0], u), _l(a[1], b[1], u) - h * 4 * u * (1 - u), tau]; }
return [880 - (tau - BOUNCE[1]) * 1900, floor, tau];
}
function sceneBody(g, tau, o = {}) {
page(g);
text(g, 'salute.', colX(0), 300, 200, 800);
text(g, 'rule 7 — arm to 90°, hand to brow.', colX(0), 372, 30, 500);
if (tau > .2) { g.save(); g.strokeStyle = SW.red; g.lineWidth = 5; g.beginPath(); g.moveTo(colX(0) + 190, 360); g.lineTo(colX(0) + 262, 360); g.stroke(); g.restore(); text(g, '212°', colX(0) + 270, 330, 30, 800, SW.red); }
// baseline
g.save(); g.fillStyle = SW.ink; g.fillRect(GRID.m, DY, 1920 - 2 * GRID.m, 3); g.restore();
const [a, L] = armAt(tau);
const [bx, by] = ballAt(tau);
const attached = tau <= 0;
const look = tau > .15 ? -1 : 1;
const antBend = tau > 0 ? Math.sin(tau * 30) * Math.exp(-tau * 5) * .6 : 0;
cadetSwiss(g, DX, DY, U, { arm: a, armLen: L, ballShow: attached, look, antBend });
if (!attached) { g.save(); g.fillStyle = SW.red; g.beginPath(); g.arc(bx, by, .75 * U, 0, TAU); g.fill(); g.restore(); }
// out-of-grid annotation
if (tau > .82) { const x = Math.max(GRID.m + 10, bx); g.save(); g.fillStyle = SW.red; g.fillRect(GRID.m, DY + 40, 3, 60); g.restore(); text(g, '← off grid', GRID.m + 16, DY + 86, 34, 700, SW.red); }
// at the moment of the hit: one short impact line
if (tau > 0 && tau < .12) { g.save(); g.strokeStyle = SW.ink; g.lineWidth = 6; for (let i = 0; i < 5; i++) { const aa = -2.2 + i * .45; g.beginPath(); g.moveTo(BALL0[0] + Math.cos(aa) * 50, BALL0[1] + Math.sin(aa) * 50); g.lineTo(BALL0[0] + Math.cos(aa) * 90, BALL0[1] + Math.sin(aa) * 90); g.stroke(); } g.restore(); }
}
export function sceneSalute(g, lt, o = {}) {
const T = o.step === false ? lt : Math.floor(lt * 12) / 12;
if (T >= SAL.rep0 && T < SAL.rep1) {
// instant replay: freeze for 3 frames first, then 0.5× slow motion around the hit, camera pushes in on the head
const u = (T - SAL.rep0) / (SAL.rep1 - SAL.rep0);
const tau = u < .12 ? -.32 : _l(-.32, .32, (u - .12) / .88);
const z = _l(1.0, 1.4, _eo(_seg(u, 0, .25)));
g.save(); g.translate(BALL0[0] - 60, 215); g.scale(z, z); g.translate(-(BALL0[0] - 60), -215);
sceneBody(g, tau); g.restore();
// replay marker (Swiss-style black bar + red dot)
g.save(); g.fillStyle = SW.ink; g.fillRect(0, 0, 1920, 110); g.fillRect(0, 1020, 1920, 60); g.restore();
text(g, 'instant replay', GRID.m, 76, 52, 800, SW.paper);
text(g, '0.5× ◀◀ 00:00:01.29', 1920 - GRID.m, 72, 30, 600, SW.paper, { align: 'right' });
if (Math.floor(lt * 6) % 2 === 0) { g.save(); g.fillStyle = SW.red; g.beginPath(); g.arc(GRID.m + 420, 58, 16, 0, TAU); g.fill(); g.restore(); }
return;
}
sceneBody(g, live7(T) - SAL.hit);
}