def play(self, *args, **kwargs): if len(args) == 0: warnings.warn("Called Scene.play with no animations") return if self.skip_animations: kwargs["run_time"] = 0 animations = self.compile_play_args_to_animation_list(*args) self.num_plays += 1 sync_animation_run_times_and_rate_funcs(*animations, **kwargs) moving_mobjects, static_mobjects = \ self.separate_moving_and_static_mobjects(*animations) self.update_frame(static_mobjects) static_image = self.get_frame() for t in self.get_animation_time_progression(animations): for animation in animations: animation.update(t / animation.run_time) self.continual_update() self.update_frame(moving_mobjects, static_image) self.add_frames(self.get_frame()) self.add(*moving_mobjects) self.mobjects_from_last_animation = moving_mobjects self.clean_up_animations(*animations) self.continual_update(0) return self
def play(self, *args, **kwargs): if len(args) == 0: warnings.warn("Called Scene.play with no animations") return if self.skip_animations: kwargs["run_time"] = 0 animations = self.compile_play_args_to_animation_list(*args) self.num_plays += 1 sync_animation_run_times_and_rate_funcs(*animations, **kwargs) moving_mobjects, static_mobjects = \ self.separate_moving_and_static_mobjects(*animations) if 'order_f' in kwargs: moving_mobjects.sort(key=kwargs['order_f']) self.update_frame(static_mobjects) static_image = self.get_frame() for t in self.get_time_progression(animations): for animation in animations: animation.update(t / animation.run_time) if len(self.extra_mobjects_for_animation) > 0: with_points = [] for mob in self.extra_mobjects_for_animation: with_points += mob.family_members_with_points() self.update_frame(moving_mobjects + with_points, static_image) self.extra_mobjects_for_animation = () else: self.update_frame(moving_mobjects, static_image) self.add_frames(self.get_frame()) self.add(*moving_mobjects) self.mobjects_from_last_animation = moving_mobjects self.clean_up_animations(*animations) self.extra_mobjects_for_animation = () if 'order_f' in kwargs: self.mobjects.sort(key=kwargs['order_f']) return self
def play(self, *args, **kwargs): if len(args) == 0: warnings.warn("Called Scene.play with no animations") return if self.skip_animations: kwargs["run_time"] = 0 animations = self.compile_play_args_to_animation_list(*args) self.num_plays += 1 sync_animation_run_times_and_rate_funcs(*animations, **kwargs) moving_mobjects, static_mobjects = \ self.separate_moving_and_static_mobjects(*animations) self.update_frame(static_mobjects) static_image = self.get_frame() for t in self.get_time_progression(animations): for animation in animations: animation.update(t / animation.run_time) self.update_frame(moving_mobjects, static_image) self.add_frames(self.get_frame()) self.add(*moving_mobjects) self.mobjects_from_last_animation = moving_mobjects self.clean_up_animations(*animations) return self