manim_animations

Manim’s signature animations, as Algan animated functions.

DrawBorderThenFill() is the hand-drawing effect: the outline is traced as though by a pen, then the fill washes in behind it. It takes any iterable of Mobs, so it works on shapes as readily as on text.

write() and write() are the glyph-wise shorthand for the same effect, staggering it across characters.

Functions

DrawBorderThenFill(mobs, runtime=None, lag_ratio=None, stroke_width=1, stroke_color=None, easing=<function identity>, reverse=False)[source]

Animate mobs appearing as if hand-drawn: outline first, then fill.

Each mob’s border is traced out, then its fill fades in. Mobs are animated in iteration order, each starting slightly before the previous one finishes, which reads as a hand moving across the screen.

Parameters:
  • mobs – Any iterable of Mobs: the glyphs of a Text, a Group’s children, or a list you assembled yourself. Drawn in iteration order.

  • runtime – Total seconds for the whole sequence. Defaults to 1 second, or 2 for more than 15 mobs.

  • lag_ratio – Fraction of one mob’s animation that elapses before the next begins. Defaults to a value that keeps the whole sequence legible.

  • stroke_width – Temporary outline width while the border is drawn. The original widths are restored as the fills appear. If None, the existing widths are used. Defaults to 1, equivalent to Manim’s stroke width of 2.

  • stroke_color – Temporary outline color. Defaults to each Mob’s existing border color. write() supplies white for an ordinary stroke-free Text, matching Manim’s Pango text style.

  • easing – Easing applied to each glyph. Defaults to linear timing, as Manim’s Write does.

  • reverse – Draw the Mobs in reverse iteration order. Defaults to False.

Returns:

The mobs that were animated, in the order they were drawn.

Return type:

list of Mob

Examples

Example: Example1MAnimationsDrawBorderThenFill

from algan import *

squares = Group([Square() for _ in range(3)]).arrange_in_line(RIGHT).spawn()
DrawBorderThenFill(squares.children)

Scene.save_video()

See also

write()

the same animation over a text’s glyphs.