4

I found out that this animation takes a lot of time to render when there are more than 20 lines of text. Is there anything I can do to speed it up?

import itertools as it

class FormulaExample(Scene):
  def setup(self):
    self.text_example = Text("How are we doing?\nPlease help us\nimprove Stack Overflow.\nThanks!", font="Roboto", stroke_width=0)

class FadeInFromDirections(LaggedStart):
    CONFIG = {
        "directions":[DL,DOWN,DR,RIGHT,UR,UP,UL,LEFT],
        "magnitude":1,
        "lag_ratio":.05
    }
    def __init__(self, text , **kwargs):
        digest_config(self, kwargs)
        self.reverse_directions=it.cycle(list(reversed(self.directions)))
        super().__init__(
            *[FadeInFromPoint(obj,point=obj.get_center()+d*self.magnitude)
                for obj,d in zip(text,self.reverse_directions)],
            **kwargs
        )

class FadeInFromDirectionsExample(FormulaExample):
    def construct(self):
        self.play(
            FadeInFromDirections(self.text_example),
            run_time=3
        )
        self.wait()

1 Answers1

0

when compiling, you can use low quality mode, this will speed up compilation significantly, (which is good enough for previewing)

Rainb
  • 1,965
  • 11
  • 32