Skip to content

OpenSenseNova/SenseNova-Skills / skills/sn-motion-html

sn-motion-html

Verified

Build continuous-shot motion-driven HTML stories from a subject or narrative, including research, story structure, consistent AI stills, Seedance scene and connector clips, interface styling, media normalization, and browser QA. Use for immersive journeys, timelines, product stories, fictional worlds, or other scene-based visual narratives whose camera should flow from beginning to end; not for ordinary autoplay video pages or general web apps.

scripts/contact_sheet.py

View on GitHub
#!/usr/bin/env python3
"""Create a labeled midpoint contact sheet for every declared video clip."""

from __future__ import annotations

import argparse
import json
import math
from pathlib import Path
import shutil
import subprocess
from PIL import Image, ImageDraw


def main() -> int:
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("project_root", type=Path)
    parser.add_argument("--columns", type=int, default=4)
    parser.add_argument("--cell-width", type=int, default=384)
    parser.add_argument("--output", type=Path)
    args = parser.parse_args()
    if shutil.which("ffmpeg") is None:
        raise SystemExit("ffmpeg is required")

    root = args.project_root.expanduser().resolve()
    manifest = json.loads((root / "prompts" / "video-manifest.json").read_text(encoding="utf-8"))
    records = [("dive", item) for item in manifest.get("dives", [])]
    records += [("connector", item) for item in manifest.get("connectors", [])]
    missing = [root / item["output"] for _, item in records if not (root / item["output"]).exists()]
    if missing:
        raise SystemExit("Missing media: " + ", ".join(str(path.relative_to(root)) for path in missing))

    frame_dir = root / "tmp" / "contact-sheet"
    frame_dir.mkdir(parents=True, exist_ok=True)
    duration = float(manifest.get("duration", 4))
    frames: list[tuple[str, Path]] = []
    for index, (kind, item) in enumerate(records):
        frame = frame_dir / f"{index:03d}-{kind}-{item['id']}.jpg"
        subprocess.run([
            "ffmpeg", "-v", "error", "-y", "-ss", str(duration / 2),
            "-i", str(root / item["output"]), "-frames:v", "1", str(frame),
        ], check=True)
        frames.append((f"{kind}: {item['id']}", frame))

    columns = max(1, args.columns)
    rows = math.ceil(len(frames) / columns)
    cell_width = args.cell_width
    cell_height = round(cell_width * 9 / 16)
    label_height = 30
    sheet = Image.new("RGB", (columns * cell_width, rows * (cell_height + label_height)), "#f2ebdd")
    draw = ImageDraw.Draw(sheet)
    for index, (label, frame) in enumerate(frames):
        with Image.open(frame) as image:
            image = image.convert("RGB").resize((cell_width, cell_height), Image.Resampling.LANCZOS)
        x = (index % columns) * cell_width
        y = (index // columns) * (cell_height + label_height)
        sheet.paste(image, (x, y))
        draw.text((x + 8, y + cell_height + 7), label, fill="#25231f")

    output = (args.output or (root / "tmp" / "contact-sheet.png")).resolve()
    output.parent.mkdir(parents=True, exist_ok=True)
    sheet.save(output)
    print(output)
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall