def add_foreground_mobjects(self, *mobjects): self.foreground_mobjects = list_update( self.foreground_mobjects, mobjects ) self.add(*mobjects) return self
def add_foreground_mobjects(self, *mobjects): self.foreground_mobjects = list_update( self.foreground_mobjects, mobjects ) self.add(*mobjects) return self
def update_frame( #TODO Description in Docstring self, mobjects=None, background=None, include_submobjects=True, ignore_skipping=True, **kwargs): """ Parameters: ----------- mobjects: list list of mobjects background: np.ndarray Pixel Array for Background include_submobjects: bool (True) ignore_skipping : bool (True) **kwargs """ if self.skip_animations and not ignore_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 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.set_submobjects(list_update(self.submobjects, mobject_attrs)) return self
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 = Mobject.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.submobjects, moving_mobjects) return moving_mobjects
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 add_foreground_mobjects(self, *mobjects): """ Adds mobjects to the foreground, and internally to the list foreground_mobjects, and mobjects. Parameters ---------- *mobjects : Mobject The Mobjects to add to the foreground. Returns ------ Scene The Scene, with the foreground mobjects added. """ self.foreground_mobjects = list_update(self.foreground_mobjects, mobjects) self.add(*mobjects) return self
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 get_moving_mobjects(self, *animations): """ This method returns a list of all of the Mobjects in the Scene that are moving, that are also in the animations passed. Parameters ---------- *animations (Animation) The animations whose mobjects will be checked. """ 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, ignore_skipping=True, **kwargs): if self.skip_animations and not ignore_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_to_back(self, *mobjects): self.set_submobjects(list_update(mobjects, self.submobjects)) return self
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(self, *animations): if self in animations: raise Exception("Animation cannot contain self") self.subanimations = list_update(self.subanimations, animations) return self