khan-explainer
Use when the user wants a Khan Academy style explainer video, a blackboard or whiteboard lesson, a hand-drawn chalk-talk animation, a short narrated video that teaches a concept ("explain X in a video", "explainer video", "teach X in 30 seconds"), or a tutorial that draws hand-written arrows, circles and captions over product screenshots ("draw over the UI", "annotated walkthrough"), or clips cut from a YouTube video or podcast where the speaker's real audio plays under a blackboard drawn to it ("khanify this video", "clip this with the Khan visual"), especially when it must be free, local, and use no paid APIs or keys. macOS only.
haiderfarooq3 · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add haiderfarooq3/khan-explainer --skill khan-explainer技能说明
name: khan-explainer description: Use when the user wants a Khan Academy style explainer video, a blackboard or whiteboard lesson, a hand-drawn chalk-talk animation, a short narrated video that teaches a concept ("explain X in a video", "explainer video", "teach X in 30 seconds"), or a tutorial that draws hand-written arrows, circles and captions over product screenshots ("draw over the UI", "annotated walkthrough"), or clips cut from a YouTube video or podcast where the speaker's real audio plays under a blackboard drawn to it ("khanify this video", "clip this with the Khan visual"), especially when it must be free, local, and use no paid APIs or keys. macOS only.
Copy of the root SKILL.md for skills.sh discovery. The root file is the source of truth.
Khan Explainer
A pen draws while a voice explains. Three modes, one renderer:
- Blackboard lesson. A diagram drawn on a black board, Khan Academy style.
- Draw-over-UI tutorial. Arrows, circles and numbered captions drawn over product screenshots.
- Real-audio clip. A real person's voice, cut from a video, with the board drawn to their words. See "Real-audio clips".
One scene file in, one MP4 out, in seconds. Free and local: HTML canvas, Playwright, macOS say, ffmpeg. No keys.
Every mode renders as chalk on a blackboard or marker on a whiteboard, landscape or vertical.
Made by Haider Farooq (github.com/haiderfarooq3). Free for anyone to use and change (MIT).
Core principle: the voice drives the clock. A scene is a list of beats. A beat is one spoken clause plus the drawing that happens while it is said. The renderer speaks each beat first, measures it, and fits that beat's drawing to it. Never hardcode seconds or guess when a word lands.
Workflow
- Script the beats. One idea per beat, split at commas and full stops. Check the length formula below.
- Plan the picture. Lesson: lay out the whole board. Tutorial: capture the stills and their rectangles. Each has a section below.
- Write
scene.jsin a scratch folder. Copyexamples/ai-agents.jsfor a lesson orexamples/ui-tutorial.jsfor a tutorial. - Render:
node ~/.claude/skills/khan-explainer/scripts/render.js scene.js out.mp4 - Read the
sheetimage it prints. It shows the board at the end of every beat. The same folder holds every beat full-size asb000.jpg,b001.jpgand so on. Open those to check that a ring really sits on a small button. Fix everyWARN(text off the board, or one label on another), overlap and spill, then re-render. A render takes seconds, so iterate. - Deliver the MP4 and say which voice it used.
Each output line is beat N start +duration. The sheet path is new on every render.
First run on a machine: cd scripts && npm install && npx playwright install chromium.
Length and pace
| Pace | Settings | Seconds, roughly |
|---|---|---|
| Quick explainer | defaults: rate: 170, gap: 0.15 | words ÷ 3 + beats × 0.15 + 1.3 |
| Tutorial | rate: 150, gap: 0.6 | words ÷ 2.9 + beats × 0.6 + 1.3 |
A 10-second explainer is about 24 words in 5 beats. A 60-second tutorial is about 145 words in 15 beats. The formula lands within about 5%, and the render prints the real length. To hit a target, change the words, not rate.
Use the tutorial pace whenever the viewer has to find something on a screen. The quick pace feels rushed there.
Scene API
scene({
voice: 'Samantha', rate: 170, size: [1280, 720], // all optional. [720, 1280] = vertical
lang: 'ar', // the language spoken: picks the voice (see "Other languages")
gap: 0.15, dim: 0.2, // seconds between beats; screenshot darkening
theme: 'light', // whiteboard and marker. Leave it out for the blackboard.
beats: [
{ say: 'Spoken clause.', draw: p => { /* p runs 0 to 1 while it is spoken */ } },
{ dur: 1.5, draw: p => {} }, // silent beat, in seconds
{ clear: true, say: 'Next idea.', draw: p => {} }, // wipes the board first
{ bg: 'shots/home.png', say: 'Start here.', draw: p => {} }, // screenshot as the board
{ theme: 'dark', say: 'Lights off.', draw: p => {} } // flips the board from this beat on
// With `audio: 'audio.wav'` on the scene, nothing is spoken by the computer: each beat takes
// `at: 12.4` (seconds into that file) and `say` is only a note. See "Real-audio clips".
],
})
Every draw call is (geometry, p, style). Points are [x, y] in board units.
| Call | Draws |
|---|---|
write(str, x, y, p, {size, color, center, lang}) | Handwriting, letter by letter. y is the baseline. Arabic, Urdu and Hebrew run left from x. |
stroke(points, p, {color, width}) | Any shape, drawn progressively. |
arrow(from, to, p, {color, ctrl}) | Arrow. ctrl is a point that bends it. |
check(x, y, p, {size, color}) | Tick mark. |
line(a, b) curve(a, b, ctrl) oval(cx, cy, rx, ry) box(x, y, w, h) | Return points for stroke. |
ring(rect, pad) around(rect, pad) | An oval or a frame around a {x, y, w, h} rectangle, for stroke. |
view(captureWidth, cropTop) | Maps screenshot positions to the board. .r(rect) for a rectangle, .p(x, y) for a point. |
seg(p, from, to) | A slice of the beat, to order strokes: seg(p, 0, .4) then seg(p, .4, 1). |
C.yellow blue orange pink green red purple white | Chalk colours. On the whiteboard the same names are marker inks, and white is black. |
Text width is about 0.45 × size per character for a normal label and 0.63 × size per capital. Work it out before placing a label beside anything.
Other languages
write takes any script and writes it the way that script is written by hand. The first letter of the string decides the direction; its script picks the face.
| Script | Direction | Set in | Width per
阅读完整来源 ↗