MiniMax-AI/mcode-stack / stacks/youfang/skills/magic-move-deck
magic-move-deck
UnverifiedBuild Keynote-style Magic Move slide decks as one offline 1920×1080 HTML file: every slide is an architecture / flow diagram seen through a camera, and the elements two slides share morph and fly instead of cross-fading. Four visual styles (hand-drawn, minimal, dark neon, neo-brutalist): the agent first renders one sample slide in each style, the user picks one, then the whole deck is built in that style. Also exports 4K / 1080p video. Use for 做演示 / 做 slides / 做 PPT / Magic Move / 神奇移动 / 架构图演示 / 技术分享 deck / 动画 slides / animated architecture walkthrough. Not for bullet-point decks or a single static diagram.
scripts/snapshot_deck.py
View on GitHub"""Screenshot a Magic Move deck: every slide, chosen transitions frozen at chosen progress, title-overlap scan.
Drives the deck's test hook window.__deck (setState / freeze) in headless Chromium at 1920x1080.
Fails (exit 1) on any page error. Conclusions still come from looking at the PNGs.
usage:
python3 snapshot_deck.py keynote.html --out /tmp/shots --slides
python3 snapshot_deck.py keynote.html --out /tmp/shots --trans 0-1,1-0 --p 0.04,0.1,0.2,0.3,0.46
python3 snapshot_deck.py keynote.html --out /tmp/shots --overlap 2-3,3-2
python3 snapshot_deck.py deck.html --offline # bundled file: no http(s) reference, every slide renders
--overlap freezes i→j at p = k/40 and reports, per frame, the largest overlap between the text boxes
(Range rects, not the wider element boxes) of a flying Latin title line and a flying CJK title line
(elements with class .gh), in stage px.
"""
import argparse
import os
import re
import sys
from playwright.sync_api import sync_playwright
OVERLAP_JS = r"""() => {
const cjk = s => /[\u4e00-\u9fff]/.test(s);
const vis = [...document.querySelectorAll('.gh')].filter(e => {
let o = 1; for (let n = e; n && n.id !== 'stage'; n = n.parentElement) o *= +getComputedStyle(n).opacity;
return o > 0.02 && e.textContent.trim();
}).map(e => { const rg = document.createRange(); rg.selectNodeContents(e);
return { zh: cjk(e.textContent), r: rg.getBoundingClientRect(), t: e.textContent.trim() }; });
const S = document.getElementById('stage').getBoundingClientRect(); // only what is on screen counts
let best = null;
for (const a of vis) for (const b of vis) {
if (a.zh || !b.zh) continue;
const x0 = Math.max(a.r.left, b.r.left, S.left), x1 = Math.min(a.r.right, b.r.right, S.right);
const y0 = Math.max(a.r.top, b.r.top, S.top), y1 = Math.min(a.r.bottom, b.r.bottom, S.bottom);
const w = x1 - x0, h = y1 - y0;
if (w > 0 && h > 0 && (!best || w * h > best.w * best.h))
best = { w: Math.round(w), h: Math.round(h), x: Math.round(x0), y: Math.round(y0), en: a.t, zh: b.t };
}
return best;
}"""
def pairs(spec):
return [tuple(int(v) for v in s.split('-')) for s in spec.split(',') if s]
def main():
ap = argparse.ArgumentParser()
ap.add_argument('deck')
ap.add_argument('--out', default='/tmp/deck_shots')
ap.add_argument('--slides', action='store_true', help='screenshot every slide')
ap.add_argument('--trans', default='', help='transitions i-j[,i-j...] (0-based slide indexes)')
ap.add_argument('--p', default='0.06,0.15,0.25,0.35,0.5,0.75', help='progress values for --trans')
ap.add_argument('--overlap', default='', help='transitions to scan for title-line overlap at p = k/40')
ap.add_argument('--offline', action='store_true', help='bundled deck: assert no http reference, shoot every slide')
a = ap.parse_args()
deck = os.path.abspath(a.deck)
os.makedirs(a.out, exist_ok=True)
ok = True
if a.offline:
n = len(re.findall('http', open(deck, encoding='utf-8').read()))
print(f'http references: {n}')
ok &= n == 0
a.slides = True
with sync_playwright() as p:
browser = p.chromium.launch(args=['--force-color-profile=srgb'])
page = browser.new_page(viewport={'width': 1920, 'height': 1080})
errors = []
page.on('pageerror', lambda e: errors.append(str(e)))
if a.offline:
page.route(re.compile(r'^https?://'), lambda r: r.abort())
page.goto('file://' + deck)
page.wait_for_function('window.__ready === true', timeout=60000)
n = page.evaluate('__deck.SLIDES.length')
print(f'slides: {n}')
if a.slides:
for i in range(n):
page.evaluate(f'__deck.setState({i})')
page.screenshot(path=os.path.join(a.out, f'slide_{i:02d}.png'))
for i, j in pairs(a.trans):
for v in [float(x) for x in a.p.split(',')]:
page.evaluate(f'__deck.freeze({i}, {j}, {v})')
page.screenshot(path=os.path.join(a.out, f'trans_{i:02d}-{j:02d}_p{v:.3f}.png'))
page.evaluate(f'__deck.freeze({i}, {j}, 1)')
for i, j in pairs(a.overlap):
worst = None
for k in range(1, 40):
page.evaluate(f'__deck.freeze({i}, {j}, {k / 40})')
hit = page.evaluate(OVERLAP_JS)
if hit:
print(f' {i}->{j} p={k / 40:.3f}: {hit["w"]}x{hit["h"]}px at ({hit["x"]},{hit["y"]}) "{hit["en"]}" x "{hit["zh"]}"')
if not worst or hit['w'] * hit['h'] > worst['w'] * worst['h']:
worst = dict(hit, p=k / 40)
page.evaluate(f'__deck.freeze({i}, {j}, 1)')
print(f'overlap {i}->{j}: ' + (f'max {worst["w"]}x{worst["h"]}px at ({worst["x"]},{worst["y"]}) p={worst["p"]:.3f}' if worst else 'none'))
browser.close()
if errors:
print('page errors:', *errors, sep='\n ')
ok = False
print('screenshots in', a.out)
sys.exit(0 if ok else 1)
if __name__ == '__main__':
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 195k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 195k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 195k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 195k | Updated | Claude CodeCodex | Verified | Install |