Communitygithub.com

shwemahendran/jmathanim-skill

Write, fix and review JMathAnim (Java) animation scenes. Use when code imports com.jmathanim, extends Scene2D, or the user wants an animated explainer or math/diagram video rendered with JMathAnim in Java. Covers layout, text, timing to narration, arrows, images, and the library's silent-failure bugs in 1.5.1. Not for Python Manim.

What is jmathanim-skill?

jmathanim-skill is a Claude Code agent skill that write, fix and review JMathAnim (Java) animation scenes. Use when code imports com.jmathanim, extends Scene2D, or the user wants an animated explainer or math/diagram video rendered with JMathAnim in Java. Covers layout, text, timing to narration, arrows, images, and the library's silent-failure bugs in 1.5.1. Not for Python Manim.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/shwemahendran/jmathanim-skill/tree/HEAD/skills/jmathanim

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

JMathAnim

JMathAnim renders animations to MP4 from Java code (Scene2D, play.*). This skill targets 1.5.1. Every rule here was checked by rendering, and the examples in examples/ prove each one.

Before writing a scene

  1. Read the rule files for what the scene uses (table below). Always read rules/known-bugs.md.
  2. Extend starter/StarterScene.java (copy it into the project) and call configure(dark) in setupSketch().
  3. Plan in beats: one idea per beat, each with its own narration line. Read rules/motion-design.md for what makes a beat watchable.

Preserve the user's edits. If a scene file changed since you last read it, assume the change is intentional: re-read it and build on it. Never overwrite it with your earlier version. Ask if a change looks like a mistake.

The ten rules that matter most

  1. One focal point per beat, revealed in narration order. Nothing appears before it is mentioned. Dim or remove what is no longer discussed.
  2. Keep content inside the safe area: x within ±1.96, y between −0.97 and 1.075. The view is 4 × 2.25. Run with -Daudit=true to list violations.
  3. Position relative to things: stack().toObject(), align(), groups with setLayout(). Never place by typed coordinates.
  4. Plain text is TextMathObject with a real font ("Arial"); LaTeX only for math. Body height 0.058, never below 0.050. Predict widths (chars × height × 0.45), and wrap rather than shrink.
  5. End every beat with endBeat() after beat(clipSeconds). Never hand-sum runtimes; they round down per frame.
  6. To show things together, put them in one play.run(...). Separate calls run one after another.
  7. setArrowThickness(5) on every arrow and connector. The default head is huge.
  8. Rounded boxes come from roundedRectangle(), never OvalBox.make.
  9. Images enter with fadeIn, never showCreation; it silently adds nothing.
  10. Read the render log for ERROR. Several failures don't crash: they just leave something out.

Rule files

topicfile
Maven, scene lifecycle, configs, resolutionrules/setup.md
coordinates, view size, safe arearules/coordinates-and-safe-area.md
text, LaTeX, sizes, width estimate, wrappingrules/text.md
shapes, colours, setXxx API, fills, layers, shadowsrules/shapes-and-styling.md
stack, align, groups, tablesrules/layout.md
play.*, Commands, parallel, stagger, morphrules/animation.md
beats, narration sync, pacingrules/timing-and-beats.md
design rules, easing, focus, annotations, camera zoom, scene transitionsrules/motion-design.md
arrows, connectors, elbows, bracesrules/arrows-and-connectors.md
bitmaps, SVGrules/images-and-svg.md
silent failures and workaroundsrules/known-bugs.md

After writing a scene

  1. Compile with -Xlint:deprecation,rawtypes and fix every warning.
  2. Render at preview size (-Dpreview=true -Daudit=true) and fix any AUDIT or ERROR line.
  3. Look at the video, or grab frames with ffmpeg (ffmpeg -sseof -0.3 -i media/X_360.mp4 -frames:v 1 last.png). Check for overlaps, clipped text and anything missing.
  4. Render at production size only when the preview is right.

Related Skills