Skip to content

gooseworks-ai/goose-skills / skills/video/render-mosaic-grid-reveal

render-mosaic-grid-reveal

Verified

Render a 'mosaic-grid-reveal' video from a config — a real-DOM FULL-BLEED N×N mosaic of real product tiles that pops in one tile at a time (scatter order, ease-out-back overshoot), the grid clears, then the brand wordmark builds line-by-line followed by a sub-label, tagline, and CTA; frame-stepped via Playwright and encoded with FFmpeg — deterministic assembly, FREE (the music bed comes from create-music-elevenlabs), so the wordmark, tile captions, and CTA stay pixel-crisp. Use for the mosaic-grid-reveal format.

FileKindSize
SKILL.mdskill md4.5 KB
scripts/_shared.jsscript950 B
scripts/build_html.pyscript8.8 KB
scripts/config.example.jsonconfig2.8 KB
scripts/render.pyscript2.5 KB
skill.meta.jsonconfig220 B
tests/smoke-test.mdmarkdown1.3 KB

scripts/render.py

View on GitHub
#!/usr/bin/env python3
"""Frame-step a promo-card hyperframe.html → silent mp4 (Playwright + ffmpeg).

Pure-function-of-time: calls window.renderAt(t) per frame and screenshots — fully
deterministic, no paid calls. Reads dims/fps/duration from config.json.

Usage:  render.py --config config.json --html <run>/hyperframe.html --out <run>/master-silent.mp4
Fallback (no Playwright): screenshot the HTML at N frame times via the chrome-devtools
MCP (evaluate window.renderAt(t) → screenshot) and encode with the ffmpeg block below.
"""
import argparse
import asyncio
import json
import pathlib
import shutil
import subprocess

from playwright.async_api import async_playwright


async def run(cfg, html_path, out_path):
    fps = cfg.get("fps", 25)
    dur = cfg.get("duration_sec", 10.0)
    W, H = cfg.get("width", 1080), cfg.get("height", 1920)
    scratch = out_path.parent / "_scratch_frames"
    if scratch.exists():
        shutil.rmtree(scratch)
    scratch.mkdir(parents=True)

    async with async_playwright() as p:
        b = await p.chromium.launch(args=["--autoplay-policy=no-user-gesture-required"])
        ctx = await b.new_context(viewport={"width": W, "height": H}, device_scale_factor=1)
        page = await ctx.new_page()
        await page.goto(html_path.resolve().as_uri())
        await page.wait_for_function("window.__driverReady === true", timeout=15000)
        await page.evaluate("document.fonts.ready")
        n = round(dur * fps)
        for i in range(n):
            t = i / fps
            await page.evaluate(f"window.renderAt({t})")
            await page.evaluate("new Promise(r => requestAnimationFrame(() => requestAnimationFrame(r)))")
            await page.screenshot(path=str(scratch / f"frame_{i:04d}.png"),
                                  clip={"x": 0, "y": 0, "width": W, "height": H})
        await b.close()

    subprocess.run(["ffmpeg", "-y", "-framerate", str(fps),
                    "-i", str(scratch / "frame_%04d.png"),
                    "-c:v", "libx264", "-pix_fmt", "yuv420p", "-crf", "18", "-r", str(fps),
                    "-movflags", "+faststart", str(out_path)], check=True)
    shutil.rmtree(scratch)
    print(f"[render] {out_path}")


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--config", required=True)
    ap.add_argument("--html", required=True)
    ap.add_argument("--out", required=True)
    args = ap.parse_args()
    cfg = json.loads(pathlib.Path(args.config).read_text())
    asyncio.run(run(cfg, pathlib.Path(args.html), pathlib.Path(args.out)))


if __name__ == "__main__":
    main()
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 323kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 323kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 323kUpdated 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