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
readcheck: cap credited reading time at the end of the film (#4)
CBOSSX375de139c7ac
diff --git a/core/render/readcheck.mjs b/core/render/readcheck.mjsindex 026b264..860afc2 100644--- a/core/render/readcheck.mjs+++ b/core/render/readcheck.mjs@@ -26,7 +26,7 @@ const res = await page.evaluate(({ STEP }) => {if (!(b.x0 >= 0 && b.y0 >= 0 && b.x1 <= W && b.y1 <= H)) { partial[key] ??= { id: b.id, text: b.text, t0: t }; continue; }vis.add(key);const s = seen[key] ??= { id: b.id, text: b.text, t0: t, run: 0, done: false };- if (!s.done) s.run = t - s.t0 + STEP;+ if (!s.done) s.run = Math.min(t + STEP, window.DUR) - s.t0;}for (const k in seen) if (!vis.has(k)) seen[k].done = true; // 只算第一次连续在画的时长}diff --git a/core/render/readcheck.test.mjs b/core/render/readcheck.test.mjsnew file mode 100644index 0000000..2b33fa1--- /dev/null+++ b/core/render/readcheck.test.mjs@@ -0,0 +1,54 @@+import assert from 'node:assert/strict';+import { spawnSync } from 'node:child_process';+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';+import os from 'node:os';+import path from 'node:path';+import { fileURLToPath } from 'node:url';+import test from 'node:test';++const checker = fileURLToPath(new URL('./readcheck.mjs', import.meta.url));+function check(duration, text, options = [], visibleFrom = 0) {+ const dir = mkdtempSync(path.join(os.tmpdir(), 'lemo-readcheck-'));+ try {+ writeFileSync(path.join(dir, 'index.html'), `<script>+ window.DUR = ${duration};+ window.render = () => {};+ window.TEXTS = t => t >= ${visibleFrom}+ ? [{ id: 'caption', text: ${JSON.stringify(text)}, x0: 0, y0: 0, x1: 100, y1: 20 }]+ : [];+ window.READY = true;+ </script>`);+ const result = spawnSync(process.execPath, [checker, dir, ...options], {+ encoding: 'utf8', timeout: 30000+ });+ assert.ifError(result.error);+ assert.equal(result.signal, null, result.stderr);+ return result;+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+}++test('readcheck does not credit time beyond the end of the film', () => {+ // Three letters need 1.70 s; default 0.04 s sampling used to credit 1.72 s.+ const result = check(1.69, 'abc');+ assert.equal(result.status, 1, result.stdout + result.stderr);+ assert.match(result.stdout, /need 1\.70s got 1\.69s/);+});++test('readcheck accepts text held for exactly its required duration', () => {+ const result = check(1.70, 'abc');+ assert.equal(result.status, 0, result.stdout + result.stderr);+});++test('readcheck clamps a sample step longer than the whole film', () => {+ const result = check(0.5, 'abc', ['--step', '2']);+ assert.equal(result.status, 1, result.stdout + result.stderr);+ assert.match(result.stdout, /got 0\.50s/);+});++test('readcheck gives no reading time to text appearing at the endpoint', () => {+ const result = check(2, 'abc', ['--step', '2'], 2);+ assert.equal(result.status, 1, result.stdout + result.stderr);+ assert.match(result.stdout, /got 0\.00s/);+});