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
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
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)
def add(self, *mobjects): if self in mobjects: raise Exception("Mobject cannot contain self") self.submobjects = list_update(self.submobjects, mobjects) return self
def add_foreground_mobjects(self, *mobjects): self.foreground_mobjects = list_update(self.foreground_mobjects, mobjects) self.add(*mobjects) return self