Маним - Выравнивание членов в уравнении - PullRequest
0 голосов
/ 26 апреля 2020

У меня есть простая сцена manim, которая решает уравнение 2x-3 = -7. Я хотел бы сохранить 2x выровненными по вертикали между каждым шагом (так как знак равенства был выровнен). Можно ли это сделать?

class BasicEquationsSimple(Scene):
    def construct(self):
        equation0 = TexMobject("2x - 3", "=", "{-7}")
        equation1 = TexMobject("2x", "=", "{-4}").next_to(equation0, DOWN)
        equation2 = TexMobject("x", "=", "{-2}").next_to(equation1, DOWN)

        eq0 = equation0.get_part_by_tex('=')
        eq1 = equation1.get_part_by_tex('=').align_to(eq0, LEFT)
        eq2 = equation2.get_part_by_tex('=').align_to(eq1, LEFT)

        equation0.get_part_by_tex('2x - 3').next_to(eq0, LEFT)
        equation0.get_part_by_tex('{-7}').next_to(eq0, RIGHT)
        equation1.get_part_by_tex('2x').next_to(eq1,LEFT)
        equation1.get_part_by_tex('{-4}').next_to(eq1, RIGHT)
        equation2.get_part_by_tex('x').next_to(eq2, LEFT)
        equation2.get_part_by_tex('{-2}').next_to(eq2, RIGHT)

        self.play(Write(equation0,run_time=3))
        self.play(Write(equation1))
        self.play(Write(equation2))

Manim scene

...