Skip to content

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 种现成风格,也能做出你自己的

2.0 KB
Raw Blame
import { makeComp, layerSet } from './comp.js';
import { DUR, T, VO } from './story.js';
import { subtitle } from './subs.js';
import { clamp } from '/core/lib.js';
const q = new URLSearchParams(location.search);
const comp = makeComp(document.getElementById('c'));
const A = layerSet(), B = layerSet(), TMP = layerSet();
const mode = q.get('test');
await document.fonts.load('600 40px CormorantSC'); await document.fonts.load('500 40px CormorantSC');
await document.fonts.load('italic 500 40px Cormorant'); await document.fonts.load('500 40px Cormorant');
await document.fonts.load('40px MaShanZheng', '水');
const NOSUB = q.has('nosub') || q.has('poster'), POSTER = q.has('poster');

let render;
if (mode) {
  const mod = await import('./test.js');
  window.DUR = 1;
  render = t => mod.render(t, A, B, comp, mode);
} else {
  const S = await import('./shots.js');
  await S.init(TMP);
  window.DUR = DUR;
  window.EV = S.events();
  render = t => {
    A.clear(); B.clear();
    const o = S.frame(t, A, B, TMP) || {};
    // Subtitles (as tiba 题跋, inscriptions): placed in the current shot's liubai (留白, left-blank space)
    if (!NOSUB) for (const v of VO) {
      const [a, b] = v.sub; if (t < a || t > b) continue;
      const k = Math.min(clamp((t - a) / .35), clamp((b - t) / .4));
      const pos = S.subPos(v.id, t);
      subtitle(o.subInB ? B : A, v.text, pos[0], pos[1], k, { size: pos[2] || 46 });
    }
    if (POSTER) {   // poster: film title inscribed in the blank space over the river
      const c = A.cd; c.save(); c.setTransform(1, 0, 0, 1, 0, 0); c.fillStyle = '#000'; c.globalAlpha = .9;
      c.font = '600 64px CormorantSC'; c.letterSpacing = '12px'; c.fillText('THE SWORDSMAN', 170, 800); c.fillText('AND THE RIVER', 170, 885);
      c.font = 'italic 500 30px Cormorant'; c.letterSpacing = '3px'; c.globalAlpha = .7; c.fillText('a Chinese ink wash film', 174, 945); c.restore();
      A.cc.setTransform(1, 0, 0, 1, 0, 0); S.seal(A.cc, 900, 815, 76, .95, 5);
    }
    comp(A, B, o);
  };
}
window.render = render;
window.READY = true;