Skip to content

MLP208: Transform of a large Text/MathTex family

qual reports MLP208 when a played Transform-family animation has a source or target that is definitely a Text / MarkupText / MathTex / SingleStringMathTex / Tex object and the glyph family is provably large: text mobjects decompose into one submobject per glyph, so Animation.begin pays a whole-glyph-family copy, per-submobject point alignment, and per-glyph interpolation on every frame of the play.

  • Default severity: info
  • Minimum confidence: high
  • Implementation phase: 3
  • Fix: none
  • Supersedes: MLP207 (the kind test specializes the generic begin-cost rule; when both hold, exactly one MLP208 is reported)

The kind test selects the specialization; the size gate (DESIGN 7.3 "large Text / MathTex family") is met by either of:

  • the structural numbers, when they are real (transform_begin_gate_met: confirmed family >= 32 or confirmed curve insertion >= 256), or
  • a lower bound counted from the literal constructor content of either side: at least 32 rendered content characters must be proven. TeX sources count only characters that provably render (syntax characters, comments, and control sequences count zero); Pango markup skips tags and counts each entity once. Non-literal arguments contribute nothing, so the bound only under-counts.

Glyph counts are content-dependent and deliberately Unknown in the size facts, so the evidence carries the resolved kind facts, the content-gate lower bound, and only such numeric bounds as are actually proven — never a fabricated glyph count (DESIGN §15). The kind must be definite (KindSet::Known with only Text/TeX candidates) on a definite play path; branch-dependent or unresolved values stay silent, and an idiomatic short title transform (below the content gate) stays silent.

Wrong

class Demo(Scene):
    def construct(self):
        title = Text("The quick brown fox jumps over the lazy dog by the river")
        target = MathTex(r"\alpha + \beta")
        self.add(title)
        self.play(Transform(title, target))  # copy + align + per-glyph lerp
class Demo(Scene):
    def construct(self):
        title = MathTex(r"\alpha + \beta - 1")
        target = MathTex(r"\alpha + \beta")
        self.add(title)
        # Matching glyphs move instead of re-aligning everything; for a
        # changing number, drive a DecimalNumber with set_value instead.
        self.play(TransformMatchingTex(title, target))