Example #1
0
 def get_quote(self, max_width=FRAME_WIDTH - 1):
     text_mobject_kwargs = {
         "alignment": "",
         "arg_separator": self.quote_arg_separator,
     }
     if isinstance(self.quote, str):
         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:
         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 hacky
         if self.quote_arg_separator == " ":
             quote[0].shift(0.2 * RIGHT)
             quote[-1].shift(0.2 * LEFT)
     for term, color in self.highlighted_quote_terms:
         quote.set_color_by_tex(term, color)
     quote.to_edge(UP, buff=self.top_buff)
     if quote.get_width() > max_width:
         quote.set_width(max_width)
     return quote
Example #2
0
 def get_quote(self, max_width=FRAME_WIDTH - 1):
     text_mobject_kwargs = {
         "alignment": "",
         "arg_separator": self.quote_arg_separator,
     }
     if isinstance(self.quote, str):
         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:
         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 hacky
         if self.quote_arg_separator == " ":
             quote[0].shift(0.2 * RIGHT)
             quote[-1].shift(0.2 * LEFT)
     for term, color in self.highlighted_quote_terms:
         quote.set_color_by_tex(term, color)
     quote.to_edge(UP, buff=self.top_buff)
     if quote.get_width() > max_width:
         quote.set_width(max_width)
     return quote
    def construct(self):
        line1 = TextMobject(r"The vector $\vec{F}_{net}$ is the net ", "force",
                            " on object of mass ")
        line1.set_color_by_tex("force", BLUE)

        line2 = TextMobject("$m$", " and acceleration ", r"$\vec{a}$", ".")
        line2.set_color_by_tex_to_color_map({"m": YELLOW, "{a}": RED})

        sentence = VGroup(line1, line2)
        sentence.arrange_submobjects(DOWN, buff=MED_LARGE_BUFF)
        self.play(Write(sentence))
        self.wait(3)