mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Fixed one-off error for number of frames rendered during an animation, and made it so that a final frame is always rendered after the construct method is called
This commit is contained in:
parent
47d1f8d446
commit
6ff937e893
1 changed files with 11 additions and 7 deletions
|
@ -68,6 +68,12 @@ class Scene(Container):
|
||||||
self.construct(*self.construct_args)
|
self.construct(*self.construct_args)
|
||||||
except EndSceneEarlyException:
|
except EndSceneEarlyException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Always tack on one last frame, so that scenes
|
||||||
|
# with no play calls still display something
|
||||||
|
self.skip_animations = False
|
||||||
|
self.wait(self.frame_duration)
|
||||||
|
|
||||||
if self.write_to_movie:
|
if self.write_to_movie:
|
||||||
self.close_movie_pipe()
|
self.close_movie_pipe()
|
||||||
print("Played a total of %d animations"%self.num_plays)
|
print("Played a total of %d animations"%self.num_plays)
|
||||||
|
@ -340,7 +346,7 @@ class Scene(Container):
|
||||||
times = [run_time]
|
times = [run_time]
|
||||||
else:
|
else:
|
||||||
step = self.frame_duration
|
step = self.frame_duration
|
||||||
times = np.arange(0, run_time + step, step)
|
times = np.arange(0, run_time, step)
|
||||||
time_progression = ProgressDisplay(times)
|
time_progression = ProgressDisplay(times)
|
||||||
return time_progression
|
return time_progression
|
||||||
|
|
||||||
|
@ -475,13 +481,12 @@ class Scene(Container):
|
||||||
self.continual_update()
|
self.continual_update()
|
||||||
self.update_frame()
|
self.update_frame()
|
||||||
self.add_frames(self.get_frame())
|
self.add_frames(self.get_frame())
|
||||||
elif not self.skip_animations:
|
elif self.skip_animations:
|
||||||
|
#Do nothing
|
||||||
|
return self
|
||||||
|
else:
|
||||||
self.update_frame()
|
self.update_frame()
|
||||||
self.add_frames(*[self.get_frame()]*int(duration / self.frame_duration))
|
self.add_frames(*[self.get_frame()]*int(duration / self.frame_duration))
|
||||||
else:
|
|
||||||
#If self.skip_animations is set, do nothing
|
|
||||||
pass
|
|
||||||
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def wait_to(self, time, assert_positive = True):
|
def wait_to(self, time, assert_positive = True):
|
||||||
|
@ -612,4 +617,3 @@ class EndSceneEarlyException(Exception):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue