From 5639f2e6c3fee6944b5d211b5c5c81d75a00bd19 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 20 Feb 2018 11:28:11 -0800 Subject: [PATCH 1/5] Use generate_target in method compiling of scene.play --- scene/scene.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/scene.py b/scene/scene.py index fda15aaf..5a471485 100644 --- a/scene/scene.py +++ b/scene/scene.py @@ -380,7 +380,7 @@ class Scene(Container): animations.pop() #method should already have target then. else: - mobject.target = mobject.deepcopy() + mobject.generate_target() # if len(state["method_args"]) > 0 and isinstance(state["method_args"][-1], dict): method_kwargs = state["method_args"].pop() From 1a22b949e1a3dda567d379b7eecc7ef041e9724e Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 20 Feb 2018 11:28:59 -0800 Subject: [PATCH 2/5] Removed super-over-DRY implementation of style propagation in vmobjects --- mobject/vectorized_mobject.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mobject/vectorized_mobject.py b/mobject/vectorized_mobject.py index a3ac3372..0e4cb237 100644 --- a/mobject/vectorized_mobject.py +++ b/mobject/vectorized_mobject.py @@ -54,10 +54,14 @@ class VMobject(Mobject): if fill_opacity is not None: self.fill_opacity = fill_opacity if family: - kwargs = locals() - kwargs.pop("self") for mob in self.submobjects: - mob.set_style_data(**kwargs) + mob.set_style_data( + stroke_color = stroke_color, + stroke_width = stroke_width, + fill_color = fill_color, + fill_opacity = fill_opacity, + family = family + ) return self def set_fill(self, color = None, opacity = None, family = True): From a71b9692bf51210ad30fdc758d78834a4dac0d29 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 20 Feb 2018 11:29:17 -0800 Subject: [PATCH 3/5] Small uncertainty progress --- active_projects/uncertainty.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/active_projects/uncertainty.py b/active_projects/uncertainty.py index 2c385c8c..1af18595 100644 --- a/active_projects/uncertainty.py +++ b/active_projects/uncertainty.py @@ -1727,7 +1727,7 @@ class IntroduceDopplerRadar(Scene): words = ["Original signal", "Echo"] for graph, word in zip([pulse_graph, echo_graph], words): arrow = Vector(DOWN) - arrow.next_to(graph.peak_point, UP, SMALL_BUFF) + arrow.next_to(graph.peak_point, UP, MED_SMALL_BUFF) arrow.match_color(graph) graph.arrow = arrow label = TextMobject(word) @@ -2035,7 +2035,9 @@ class IntroduceDopplerRadar(Scene): sum_graph.background_image_file = "blue_yellow_gradient" return pulse_graph, echo_graph, sum_graph - +class MentionPRFNuance(TeacherStudentsScene): + def construct(self): + pass From 7fe0f0650a2ed7adfcd56ea8b87bea0f2291679a Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 20 Feb 2018 11:30:59 -0800 Subject: [PATCH 4/5] ... --- topics/light.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topics/light.py b/topics/light.py index 67f1458c..9ba8d75c 100644 --- a/topics/light.py +++ b/topics/light.py @@ -537,7 +537,7 @@ class Spotlight(VMobject): new_submob = self.new_sector(submob.inner_radius,dr,lower_angle,upper_angle) submob.points = new_submob.points submob.set_fill(opacity = 10 * self.opacity_function(submob.outer_radius)) - print "new opacity:", self.opacity_function(submob.outer_radius) + # print "new opacity:", self.opacity_function(submob.outer_radius) From d3a39f2e65ba1a448846776f26926f4de06de708 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 20 Feb 2018 14:03:59 -0800 Subject: [PATCH 5/5] Enabling transparent background of exported videos --- extract_scene.py | 2 ++ scene/scene.py | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/extract_scene.py b/extract_scene.py index 0d21e8a7..cec13bdf 100644 --- a/extract_scene.py +++ b/extract_scene.py @@ -95,6 +95,7 @@ def get_configuration(): "save_pngs" : args.save_pngs, #If -t is passed in (for transparent), this will be RGBA "saved_image_mode": "RGBA" if args.transparent else "RGB", + "movie_file_extension" : ".mov" if args.transparent else ".mp4", "quiet" : args.quiet or args.write_all, "ignore_waits" : args.preview, "write_all" : args.write_all, @@ -237,6 +238,7 @@ def main(): "write_to_movie", "output_directory", "save_pngs", + "movie_file_extension", "start_at_animation_number", "end_at_animation_number", ] diff --git a/scene/scene.py b/scene/scene.py index 5a471485..09c6ffa1 100644 --- a/scene/scene.py +++ b/scene/scene.py @@ -570,18 +570,23 @@ class Scene(Container): FFMPEG_BIN, '-y', # overwrite output file if it exists '-f', 'rawvideo', - '-vcodec','rawvideo', '-s', '%dx%d'%(width, height), # size of one frame '-pix_fmt', 'rgba', '-r', str(fps), # frames per second '-i', '-', # The imput comes from a pipe '-an', # Tells FFMPEG not to expect any audio - '-vcodec', 'mpeg', - '-c:v', 'libx264', - '-pix_fmt', 'yuv420p', '-loglevel', 'error', - temp_file_path, ] + if self.movie_file_extension == ".mov": + # This is if the background of the exported video + # should be transparent. + command += ['-vcodec', 'png'] + else: + command += [ + '-c:v', 'libx264', + '-pix_fmt', 'yuv420p', + ] + command += [temp_file_path] # self.writing_process = sp.Popen(command, stdin=sp.PIPE, shell=True) self.writing_process = sp.Popen(command, stdin=sp.PIPE)