OpenParable
Skip to content
← Back to skills

Stroke Order

Design
stroke-order

Stroke Order is an Agent Skill for design published in the receptron/mulmocast-cli repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

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.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/receptron/mulmocast-cli/blob/HEAD/.claude/skills/stroke-order/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/stroke-order, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

/stroke-order — Stroke Order Animation Script

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)


Phase 1: Parse Input

Input

  • Characters: $ARGUMENTS (e.g., "あいうえお", "abcdefg", "漢字")
  • If no characters are given, ask the user

Supported character types

TypeRangeExampleLanguage
Hiraganaぁ-んあいうえおja
Katakanaァ-ンアイウエオja
KanjiCJK Unified漢字書道ja
Latin lowercasea-zabcdefgen

Phase 2: Generate Script (Automated)

Output directory

SCRIPTS_DIR="${MULMO_SCRIPTS_DIR:-my-scripts}"

Run the generator script

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:

  1. Fetches KanjiVG SVG data for each character from GitHub
  2. Extracts stroke paths in correct order
  3. Calculates animation timing based on stroke count
  4. Generates the complete MulmoScript JSON

--readings option (for kanji)

Format: "onyomi/kunyomi,onyomi/kunyomi,..." — one entry per character, comma-separated.

  • Use - for missing readings (e.g., カン/- = onyomi only)
  • Multiple readings separated by ・ (e.g., カン・ガン/みず)

Effects:

  • Label: Shows 音 カン and 訓 あざ below the character
  • Speech: TTS reads "音読み、カン。訓読み、あざ。" instead of the raw kanji

Without --readings, kanji characters are spoken as-is (may result in unexpected TTS pronunciation).

Output file naming

  • Hiragana: test_stroke_order_hiragana_{romaji}.json
  • Katakana: test_stroke_order_katakana_{romaji}.json
  • Latin: test_stroke_order_alphabet_{first}_{last}.json
  • Kanji (with readings): test_stroke_order_{onyomi_romaji}.json (e.g., kan_ji)
  • Kanji (without readings): test_stroke_order_{characters}.json (e.g., 漢字)

Phase 3: Generate Movie

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


Technical Details (for reference)

KanjiVG Data

  • Repository: https://github.com/KanjiVG/kanjivg
  • Raw URL: https://raw.githubusercontent.com/KanjiVG/kanjivg/master/kanji/{5-digit-hex-codepoint}.svg
  • Unicode codepoint examples:
    • あ (U+3042) → 03042.svg
    • a (U+0061) → 00061.svg
    • 漢 (U+6F22) → 06f22.svg
  • viewBox: 0 0 109 109
  • Path IDs: kvg:{codepoint}-s1, kvg:{codepoint}-s2, etc.

Animation Technique

SVG stroke-dasharray / stroke-dashoffset animation:

  • Ghost paths: same d attributes with stroke='#9ca3af' (gray-400, always visible)
  • Animated paths: stroke='#dc2626' (red-600), stroke-dasharray='400' stroke-dashoffset='400' → animate dashoffset to 0

Stroke Color

All animated strokes use a single color: Red (#dc2626 / red-600).

Duration by Stroke Count

Base duration + 1s extra. First stroke starts 0.5s after beat begins.

StrokesDuration
15s
26s
36s
47s
57s
6+min(11, ceil(3 + n * 0.6) + 1)s

Canvas & Layout

  • Canvas: 720x720 (square)
  • SVG display: 420x420 centered
  • Guide lines: center cross with dashed lines
  • Character label below SVG: text-5xl for character, text-2xl for romanization (hiragana/katakana), text-xl for onyomi/kunyomi (kanji)
  • Background: bg-amber-50 (cream)

Beat Structure

BeatContent
introTitle screen with all characters listed
char_{id}One beat per character with animated stroke order

MulmoScript Template

{
  "$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", "...": "..." }
  ]
}

Reference

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)