Skip to content

majiayu000/spellbook / skills/code-film

code-film

Verified

用纯代码(three.js 离线渲染 + 合成音频)做有故事、有电影质感的动画短片并导出 MP4。当用户想做短片、动画片、宣传片、角色动画、循环视频、片头、产品故事片,或者说“用代码做个视频”“做一个有趣的短片”“帮我设计个小动画”“make a short film / animated video / motion piece with code”时使用,即使没提 three.js。也用于继续修改这类片子。写实真人、实拍感、AI 视频生成、普通视频剪辑不适用。

examples/last-bug/last-bug-demo.js

View on GitHub
// The program on screen in the film. Run it: bun last-bug-demo.js
// The missing semicolon glues the two lines into sum(items)[first, last] = ends(items).
const sum = xs => xs.reduce((a, b) => a + b, 0)
const ends = xs => [xs[0], xs[xs.length - 1]]

function report(items) {
  let first, last
  const total = sum(items)
  [first, last] = ends(items)
  return { total, first, last }
}

function fixed(items) {
  let first, last
  const total = sum(items);
  [first, last] = ends(items)
  return { total, first, last }
}

function test(fn) {
  const r = (() => fn([1, 2, 3]))()
  return r.total === 6 && r.first === 1 && r.last === 3
}

function runSuite(fn) {
  return test(fn)
}

function main(fn) {
  try {
    return runSuite(fn) ? 'all tests passed' : '1 failed'
  } catch (e) {
    console.log(e.stack.split('\n').slice(1).map(l => l.trim()).join('\n'))
    return '1 failed'
  }
}

console.log('without the semicolon:', main(report))
console.log('with the semicolon:   ', main(fixed))
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall