@@ -757,7 +757,7 @@ def progress_through_animations(self):
757
757
for t in self .get_animation_time_progression (self .animations ):
758
758
self .update_animation_to_time (t )
759
759
self .renderer .update_frame (self .moving_mobjects , self .static_image )
760
- self .add_frame (self .renderer .get_frame ())
760
+ self .renderer . add_frame (self .renderer .get_frame ())
761
761
762
762
def update_animation_to_time (self , t ):
763
763
"""
@@ -805,6 +805,21 @@ def play(self, *args, **kwargs):
805
805
self .cached_play (* args , ** kwargs )
806
806
self .num_plays += 1
807
807
808
+ def revert_to_original_skipping_status (self ):
809
+ """
810
+ Forces the scene to go back to its original skipping status,
811
+ by setting skip_animations to whatever it reads
812
+ from original_skipping_status.
813
+
814
+ Returns
815
+ -------
816
+ Scene
817
+ The Scene, with the original skipping status.
818
+ """
819
+ if hasattr (self , "original_skipping_status" ):
820
+ file_writer_config ["skip_animations" ] = self .original_skipping_status
821
+ return self
822
+
808
823
def cached_play (self , * args , ** kwargs ):
809
824
self .revert_to_original_skipping_status ()
810
825
self .renderer .update_skipping_status ()
@@ -888,7 +903,7 @@ def wait_internal(self, duration=DEFAULT_WAIT_TIME, stop_condition=None):
888
903
for t in time_progression :
889
904
self .update_animation_to_time (t )
890
905
self .renderer .update_frame ()
891
- self .add_frame (self .renderer .get_frame ())
906
+ self .renderer . add_frame (self .renderer .get_frame ())
892
907
if stop_condition is not None and stop_condition ():
893
908
time_progression .close ()
894
909
break
@@ -898,7 +913,9 @@ def wait_internal(self, duration=DEFAULT_WAIT_TIME, stop_condition=None):
898
913
else :
899
914
self .renderer .update_frame ()
900
915
dt = 1 / self .camera .frame_rate
901
- self .add_frame (self .renderer .get_frame (), num_frames = int (duration / dt ))
916
+ self .renderer .add_frame (
917
+ self .renderer .get_frame (), num_frames = int (duration / dt )
918
+ )
902
919
return self
903
920
904
921
def clean_up_animations (self , * animations ):
@@ -971,39 +988,6 @@ def wait_until(self, stop_condition, max_time=60):
971
988
"""
972
989
self .wait (max_time , stop_condition = stop_condition )
973
990
974
- def revert_to_original_skipping_status (self ):
975
- """
976
- Forces the scene to go back to its original skipping status,
977
- by setting skip_animations to whatever it reads
978
- from original_skipping_status.
979
-
980
- Returns
981
- -------
982
- Scene
983
- The Scene, with the original skipping status.
984
- """
985
- if hasattr (self , "original_skipping_status" ):
986
- file_writer_config ["skip_animations" ] = self .original_skipping_status
987
- return self
988
-
989
- def add_frame (self , frame , num_frames = 1 ):
990
- """
991
- Adds a frame to the video_file_stream
992
-
993
- Parameters
994
- ----------
995
- frame : numpy.ndarray
996
- The frame to add, as a pixel array.
997
- num_frames: int
998
- The number of times to add frame.
999
- """
1000
- dt = 1 / self .camera .frame_rate
1001
- self .increment_time (num_frames * dt )
1002
- if file_writer_config ["skip_animations" ]:
1003
- return
1004
- for _ in range (num_frames ):
1005
- self .file_writer .write_frame (frame )
1006
-
1007
991
def add_sound (self , sound_file , time_offset = 0 , gain = None , ** kwargs ):
1008
992
"""
1009
993
This method is used to add a sound to the animation.
0 commit comments