Create a stroke order animation MulmoScript using KanjiVG SVG data. Use when the user wants to create stroke order learning content for hiragana, katakana, kanji, or Latin alphabet characters.
Create a stroke order animation video using MulmoCast with KanjiVG SVG data. Each character is displayed in a square canvas with animated stroke-by-stroke drawing.
Data source: KanjiVG (CC BY-SA 3.0)
$ARGUMENTS (e.g., "あいうえお", "abcdefg", "漢字")| Type | Range | Example | Language |
|---|---|---|---|
| Hiragana | ぁ-ん | あいうえお | ja |
| Katakana | ァ-ン | アイウエオ | ja |
| Kanji | CJK Unified | 漢字書道 | ja |
| Latin lowercase | a-z | abcdefg | en |
SCRIPTS_DIR="${MULMO_SCRIPTS_DIR:-my-scripts}"
npx tsx .claude/skills/stroke-order/generate_stroke_order.ts "$ARGUMENTS" "${SCRIPTS_DIR}/test_stroke_order_{slug}.json"
For kanji characters, add readings with --readings:
npx tsx .claude/skills/stroke-order/generate_stroke_order.ts "漢字" "${SCRIPTS_DIR}/test_stroke_order_kanji.json" --readings "カン/-,ジ/あざ"
The generator automatically:
--readings option (for kanji)Format: "onyomi/kunyomi,onyomi/kunyomi,..." — one entry per character, comma-separated.
- for missing readings (e.g., カン/- = onyomi only)・ (e.g., カン・ガン/みず)Effects:
音 カン and 訓 あざ below the characterWithout --readings, kanji characters are spoken as-is (may result in unexpected TTS pronunciation).
test_stroke_order_hiragana_{romaji}.jsontest_stroke_order_katakana_{romaji}.jsontest_stroke_order_alphabet_{first}_{last}.jsontest_stroke_order_{onyomi_romaji}.json (e.g., kan_ji)test_stroke_order_{characters}.json (e.g., 漢字)After script generation, immediately run yarn movie (no need for separate yarn audio — all beats have fixed durations, so yarn movie handles audio generation internally).
yarn movie ${SCRIPTS_DIR}/test_stroke_order_{slug}.json
Output: output/test_stroke_order_{slug}_{lang}.mp4
https://raw.githubusercontent.com/KanjiVG/kanjivg/master/kanji/{5-digit-hex-codepoint}.svg03042.svg00061.svg06f22.svg0 0 109 109kvg:{codepoint}-s1, kvg:{codepoint}-s2, etc.SVG stroke-dasharray / stroke-dashoffset animation:
d attributes with stroke='#9ca3af' (gray-400, always visible)stroke='#dc2626' (red-600), stroke-dasharray='400' stroke-dashoffset='400' → animate dashoffset to 0All animated strokes use a single color: Red (#dc2626 / red-600).
Base duration + 1s extra. First stroke starts 0.5s after beat begins.
| Strokes | Duration |
|---|---|
| 1 | 5s |
| 2 | 6s |
| 3 | 6s |
| 4 | 7s |
| 5 | 7s |
| 6+ | min(11, ceil(3 + n * 0.6) + 1)s |
text-5xl for character, text-2xl for romanization (hiragana/katakana), text-xl for onyomi/kunyomi (kanji)bg-amber-50 (cream)| Beat | Content |
|---|---|
intro | Title screen with all characters listed |
char_{id} | One beat per character with animated stroke order |
{
"$mulmocast": { "version": "1.1" },
"lang": "ja",
"title": "書き順:ひらがな あ〜お",
"canvasSize": { "width": 720, "height": 720 },
"speechParams": {
"speakers": {
"Presenter": { "voiceId": "shimmer", "displayName": { "ja": "先生" } }
}
},
"beats": [
{ "id": "intro", "...": "..." },
{ "id": "char_a", "...": "..." }
]
}
Working examples:
my-scripts/test_stroke_order_alphabet.json (a-g)my-scripts/test_stroke_order_hiragana.json (あ-こ)my-scripts/test_stroke_order_kanji.json (漢字, with --readings)