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

839 B
Raw Blame
# Subtitle timings (same formula as setCaptions in film.js) → out/subs.json; asserts hold ≥ max(1.8, speech + 0.6) and no overlaps
import json, os
D = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
L = json.load(open(os.path.join(D, 'lines.json'))); dur = json.load(open(os.path.join(D, 'voices/dur.json')))
out = []
for l in L:
    d = dur[l['id']]; t0 = l['t'] - .05
    t1 = l['t'] + l['hold'] if 'hold' in l else max(l['t'] + 1.8, l['t'] + d + .6) + .5
    assert t1 - l['t'] >= max(1.8, d + .6) - 1e-6, (l['id'], t1 - l['t'], d)
    out.append({'t0': round(t0, 3), 't1': round(t1, 3), 'text': l['text']})
for a, b in zip(out, out[1:]): assert a['t1'] <= b['t0'], (a, b)
os.makedirs(os.path.join(D, 'out'), exist_ok=True)
json.dump(out, open(os.path.join(D, 'out/subs.json'), 'w'), indent=1)
for s in out: print(s)