MLC117: mobject changed between .animate builder creation and play¶
qual reports MLC117 for a played .animate builder whose live
mobject was definitely mutated between the builder's creation and the play
that consumes it, or whose generated target was overwritten by a later
.animate builder on the same mobject. Reading .animate runs
generate_target() immediately (DESIGN §3.2), so the animation targets
the stale snapshot.
- Default severity:
warning - Minimum confidence:
high - Implementation phase:
2 - Fix: none (moving the builder expression into the
self.play(...)call is suggested)
Only definite (all-paths) mutations between creation and play fire; a mutation inside a branch, an unknown-target builder, and a builder created directly inside the play call stay silent.
Wrong¶
class Demo(Scene):
def construct(self):
square = Square()
self.add(square)
anim = square.animate.shift(RIGHT)
square.shift(LEFT) # mutates after the target snapshot
self.play(anim)