Esempio n. 1
0
    def __init__(self, **kwargs):
        # Perhaps allow passing in a non-empty *mobjects parameter?
        Container.__init__(self, **kwargs)
        self.camera = self.camera_class(**self.camera_config)
        self.mobjects = []
        self.continual_animations = []
        self.foreground_mobjects = []
        self.num_plays = 0
        self.saved_frames = []
        self.shared_locals = {}
        self.frame_num = 0
        self.current_scene_time = 0
        self.original_skipping_status = self.skip_animations
        if self.name is None:
            self.name = self.__class__.__name__
        if self.random_seed is not None:
            random.seed(self.random_seed)
            np.random.seed(self.random_seed)

        self.setup()
        if self.write_to_movie:
            self.open_movie_pipe()
        try:
            self.construct(*self.construct_args)
        except EndSceneEarlyException:
            pass

        # Always tack on one last frame, so that scenes
        # with no play calls still display something
        self.skip_animations = False
        self.wait(self.frame_duration)

        if self.write_to_movie:
            self.close_movie_pipe()
        print("Played a total of %d animations" % self.num_plays)
Esempio n. 2
0
 def __init__(self, *submobjects, **kwargs):
     Container.__init__(self, *submobjects, **kwargs)
     if not all(map(lambda m: isinstance(m, Mobject), submobjects)):
         raise Exception("All submobjects must be of type Mobject")
     self.submobjects = list(submobjects)
     self.color = Color(self.color)
     if self.name is None:
         self.name = self.__class__.__name__
     self.init_points()
     self.generate_points()
     self.init_colors()
Esempio n. 3
0
 def __init__(self, *submobjects, **kwargs):
     Container.__init__(self, *submobjects, **kwargs)
     if not all(map(lambda m: isinstance(m, Mobject), submobjects)):
         raise Exception("All submobjects must be of type Mobject")
     self.submobjects = list(submobjects)
     self.color = Color(self.color)
     if self.name is None:
         self.name = self.__class__.__name__
     self.init_points()
     self.generate_points()
     self.init_colors()
Esempio n. 4
0
 def __init__(self, *submobjects, **kwargs):
     Container.__init__(self, *submobjects, **kwargs)
     if not all([isinstance(m, Mobject) for m in submobjects]):
         raise Exception("All submobjects must be of type Mobject")
     self.submobjects = list(submobjects)
     self.color = Color(self.color)
     if self.name is None:
         self.name = self.__class__.__name__
     self.updaters = []
     self.reset_points()
     self.generate_points()
     self.init_colors()