Пример #1
0
 def add_foreground_mobjects(self, *mobjects):
     self.foreground_mobjects = list_update(
         self.foreground_mobjects,
         mobjects
     )
     self.add(*mobjects)
     return self
Пример #2
0
 def digest_mobject_attrs(self):
     """
     Ensures all attributes which are mobjects are included
     in the submobjects list.
     """
     mobject_attrs = [x for x in list(self.__dict__.values()) if isinstance(x, Mobject)]
     self.submobjects = list_update(self.submobjects, mobject_attrs)
     return self
Пример #3
0
 def digest_mobject_attrs(self):
     """
     Ensures all attributes which are mobjects are included
     in the submobjects list.
     """
     mobject_attrs = filter(lambda x: isinstance(x, Mobject),
                            self.__dict__.values())
     self.submobjects = list_update(self.submobjects, mobject_attrs)
     return self
Пример #4
0
 def get_moving_mobjects(self, *animations):
     moving_mobjects = Scene.get_moving_mobjects(self, *animations)
     all_moving_mobjects = self.camera.extract_mobject_family_members(
         moving_mobjects)
     movement_indicators = self.camera.get_mobjects_indicating_movement()
     for movement_indicator in movement_indicators:
         if movement_indicator in all_moving_mobjects:
             # When one of these is moving, the camera should
             # consider all mobjects to be moving
             return list_update(self.mobjects, moving_mobjects)
     return moving_mobjects
Пример #5
0
 def digest_mobject_attrs(self):
     """
     Ensures all attributes which are mobjects are included
     in the submobjects list.
     """
     mobject_attrs = filter(
         lambda x: isinstance(x, Mobject),
         self.__dict__.values()
     )
     self.submobjects = list_update(self.submobjects, mobject_attrs)
     return self
 def get_moving_mobjects(self, *animations):
     moving_mobjects = Scene.get_moving_mobjects(self, *animations)
     all_moving_mobjects = self.camera.extract_mobject_family_members(
         moving_mobjects
     )
     movement_indicators = self.camera.get_mobjects_indicating_movement()
     for movement_indicator in movement_indicators:
         if movement_indicator in all_moving_mobjects:
             # When one of these is moving, the camera should
             # consider all mobjects to be moving
             return list_update(self.mobjects, moving_mobjects)
     return moving_mobjects
Пример #7
0
    def update_frame(self,
                     mobjects=None,
                     background=None,
                     include_submobjects=True,
                     dont_update_when_skipping=True,
                     **kwargs):
        if self.skip_animations and dont_update_when_skipping:
            return
        if mobjects is None:
            mobjects = list_update(
                self.mobjects,
                self.foreground_mobjects,
            )
        if background is not None:
            self.set_camera_pixel_array(background)
        else:
            self.reset_camera()

        kwargs["include_submobjects"] = include_submobjects
        self.capture_mobjects_in_camera(mobjects, **kwargs)
Пример #8
0
 def get_moving_mobjects(self, *animations):
     moving_mobjects = Scene.get_moving_mobjects(self, *animations)
     if self.camera.rotation_mobject in moving_mobjects:
         return list_update(self.mobjects, moving_mobjects)
     return moving_mobjects
Пример #9
0
 def add(self, *mobjects):
     if self in mobjects:
         raise Exception("Mobject cannot contain self")
     self.submobjects = list_update(self.submobjects, mobjects)
     return self
Пример #10
0
 def add(self, *mobjects):
     if self in mobjects:
         raise Exception("Mobject cannot contain self")
     self.submobjects = list_update(self.submobjects, mobjects)
     return self
Пример #11
0
 def get_moving_mobjects(self, *animations):
     moving_mobjects = Scene.get_moving_mobjects(self, *animations)
     if self.camera.rotation_mobject in moving_mobjects:
         return list_update(self.mobjects, moving_mobjects)
     return moving_mobjects