A community-maintained Python framework for creating mathematical animations.
added options to OpeningQuote scenes
Ben Hambrechtd239d96b7d32
diff --git a/for_3b1b_videos/common_scenes.py b/for_3b1b_videos/common_scenes.pyindex e25cd68b1..f1731d8c4 100644--- a/for_3b1b_videos/common_scenes.py+++ b/for_3b1b_videos/common_scenes.py@@ -34,6 +34,10 @@ class OpeningQuote(Scene):"lag_factor": 4,"run_time": 5,},+ "text_size" : "\\Large",+ "use_quotation_marks": True,+ "top_buff" : 1.0,+ "author_buff": 1.0,}def construct(self):@@ -42,7 +46,7 @@ class OpeningQuote(Scene):self.play(FadeIn(self.quote, **self.fade_in_kwargs))self.wait(2)- self.play(Write(self.author, run_time=3))+ self.play(Write(self.author, run_time = 3))self.wait()def get_quote(self, max_width=FRAME_WIDTH - 1):@@ -51,25 +55,32 @@ class OpeningQuote(Scene):"arg_separator": self.quote_arg_separator,}if isinstance(self.quote, str):- quote = TextMobject("``%s''" %+ if self.use_quotation_marks:+ quote = TextMobject("``%s''" %+ self.quote.strip(), **text_mobject_kwargs)+ else:+ quote = TextMobject("%s" %self.quote.strip(), **text_mobject_kwargs)else:- words = ["\\Large ``"] + list(self.quote) + ["''"]+ if self.use_quotation_marks:+ words = [self.text_size + " ``"] + list(self.quote) + ["''"]+ else:+ words = [self.text_size] + list(self.quote)quote = TextMobject(*words, **text_mobject_kwargs)# TODO, make less hackyif self.quote_arg_separator == " ":quote[0].shift(0.2 * RIGHT)quote[-1].shift(0.2 * LEFT)- for term, color in self.set_colored_quote_terms.items():+ for term, color in self.highlighted_quote_terms:quote.set_color_by_tex(term, color)- quote.to_edge(UP)+ quote.to_edge(UP, buff = self.top_buff)if quote.get_width() > max_width:quote.scale_to_fit_width(max_width)return quotedef get_author(self, quote):- author = TextMobject("\\Large -" + self.author)- author.next_to(quote, DOWN)+ author = TextMobject(self.text_size + " --" + self.author)+ author.next_to(quote, DOWN, buff = self.author_buff)author.set_color(YELLOW)return author