Skip to content

MLC113: animation kwargs passed after a .animate method access

qual reports MLC113 when animation kwargs are passed by calling a .animate builder after a method access: mob.animate.shift(RIGHT)(run_time=2). The builder accepts kwargs only on animate itself, before any method access; afterwards __call__ raises ValueError (mobject.py _AnimationBuilder).

  • Default severity: error
  • Minimum confidence: certain
  • Implementation phase: 2
  • Fix: SAFE — the trailing (kwargs) moves onto .animate itself when it consists of keyword arguments only

Wrong

class Demo(Scene):
    def construct(self):
        square = Square()
        self.add(square)
        self.play(square.animate.shift(RIGHT)(run_time=2))
class Demo(Scene):
    def construct(self):
        square = Square()
        self.add(square)
        self.play(square.animate(run_time=2).shift(RIGHT))