3b1b / manim

Animation engine for explanatory math videos
MIT License
71.59k stars 6.28k forks source link

Why it plays animations backward #1058

Closed NavpreetDevpuri closed 4 years ago

NavpreetDevpuri commented 4 years ago

from pull request https://github.com/3b1b/manim/pull/1056

it works fine if i just simply use t.set_alignment("right", 9) can anyone help me with this Why it plays animation backward ? How to resolve this ?

class Test7(Scene):
    def construct(self):
        t = Texts('this is a awesome', 'paragraph', 'With \nNewlines', '\tWith Tabs', '  With Spaces',
                  'With Alignments',
                  'center', "left", "right", line_spacing=0.1, alignment="left", t2c={"Tabs": RED})
        #t.set_alignment("center", 7)
        self.add(t)
        self.play(t.shift, RIGHT)
        rect = SurroundingRectangle(t)
        self.add(rect)
        self.play(t.set_alignment, "right", 9)
        self.play(t.set_all_lines_alignment, "center")
        self.wait()

Output ezgif-7-5529f49ea09f

NavpreetDevpuri commented 4 years ago

fixed by replacing self.lines[0][line_no].move_to() with self[line_no].move_to() because it try to move an object after VGroup() initialize