Paper-cut animated shorts
Make 30–60 second vertical (1080×1920) animated shorts in a layered paper-cut style: flat cut-out shapes with soft cast shadows, paper grain, parallax camera moves, word-by-word captions, and an original synthesized music bed with sound effects. Everything is HTML/SVG rendered frame-by-frame in headless Chrome and encoded with ffmpeg. The repo root (where this file lives) is ROOT below.
Pipeline
- Topic and facts. Agree the topic and the one-sentence takeaway with the user. For factual topics (history, science, news), research and verify every fact with at least two sources before writing. Keep the source list; it goes on the end card and in a comment at the top of
story.js. Never invent dates, names, numbers or quotes. - Script. Write 7–10 captions, one per shot, using the formula in
references/story-guide.md: hook question → setting → characters → problem → turning point → payoff → why it matters → share CTA. Each caption ≤ 12 words (≤ 2 lines). Mark one key word per caption with*asterisks*(accent colour). Show the script to the user if they are around; otherwise proceed. - Shot plan. Create
stories/<slug>/story.js(copystories/first-bangla-type/story.jsas a starting point). For each shot pick a sky, 3–7 layers fromreferences/assets.md, a camera move and entrance animations. Readreferences/story-guide.mdfor timing and composition rules. - Stills check.
python3 scripts/stills.py stories/<slug>renders 3 stills per shot plussheet.jpg. Look at the sheet and fix: captions overlapping objects, things cut off at the edges, empty-looking shots, unreadable text, characters floating above the ground. Repeat until every shot looks deliberate. - Render.
python3 scripts/render.py stories/<slug>→stories/<slug>/<slug>.mp4(H.264 + AAC, -14 LUFS target). Use--voice voice.mp3to mix in a voiceover (music ducks under it),--scale 1.3333for 1440×2560. - QA the video. Grab frames at a few timestamps with ffmpeg (
ffmpeg -ss T -i out.mp4 -frames:v 1 f.jpg) and look at them, especially at shot boundaries. Check the duration and that audio is present (ffprobe). - Deliver the MP4, plus a suggested post caption and 3–5 hashtags in the video's language.
Requirements: Python 3.9+, pip install playwright numpy pillow and python3 -m playwright install chromium (or an installed Chrome), and ffmpeg.
story.js essentials
window.STORY = {
title: "…", fps: 30, width: 1080, height: 1920,
lang: "bn", // caption language (sets the font); omit for English
music: { bpm: 92, key: "D" }, // original music bed is generated from this
shots: [{
dur: 5.5, // seconds
sky: "dawn", // dawn | day | dusk | night | paper
camera: { from: { x: -70, zoom: 1 }, to: { x: 70, zoom: 1.06 } },
caption: "*১৭৭৮* সাল। হুগলি নদীর পাড়।",
captionStyle: "hook", // hook (top, big) | card (centre) | default (lower third)
layers: [
{ asset: "hills", y: 1520, depth: 0.2, opts: { color: "#8fae6a" } },
{ asset: "person", x: 360, y: 1290, depth: 0.6, scale: 1.2,
opts: { coat: "#c8553d", pose: "write", hat: "tricorn" },
in: { type: "slide-l", at: 0.1 }, loop: { type: "bob" } },
],
}],
};
x, y= bottom-centre of the asset on the 1080×1920 stage. The ground line is usually y≈1250–1300.depth0 (far, barely moves) … 1 (near, moves most with the camera).- Entrances
in.type: pop, rise, drop, slide-l, slide-r, fade, grow. Loopsloop.type: bob, float, sway, drift, write, stamp, pulse, spin. - Captions sit at y 1300–1560 in the default style. Keep that band free of important objects, and make sure the background behind it is mid-to-dark so white text reads.
Style rules
- One idea per shot, 4–6 s each; the hook shot 3.5–4.5 s; total 40–60 s.
- Every shot moves: a slow camera move plus at least one entrance or loop. No static slides.
- Characters stand on the ground (feet at the ground line), never float.
- Max 3 accent colours per shot from the palette in
references/assets.md. Skin tones should fit the place and people of the story. - Hook first: the first shot asks the question the video answers. No logo intro, no "hello everyone".
- End card: share/follow CTA + sources (for factual videos).
- Use only original assets from
engine/assets.jsor new ones drawn in the same flat style. Don't trace copyrighted characters or logos. - To add an asset, add a function to
engine/assets.jsreturning{ w, h, svg }, and document it inreferences/assets.md.