示例#1
0
    def construct(self):
        circle = Circle(color=PURPLE_A)

        square = Square(fill_color=GOLD_B, fill_opacity=1, color=GOLD_A)
        square.move_to(UP + LEFT)

        circle.surround(square)

        rectangle = Rectangle(height=2, width=3)

        ellipse = Ellipse(width=3, height=1, color=RED)
        ellipse.shift(2 * DOWN + 2 * RIGHT)

        pointer = CurvedArrow(2 * RIGHT, 5 * RIGHT, color=MAROON_C)

        arrow = Arrow(LEFT, UP)
        arrow.next_to(circle, DOWN + LEFT)

        rectangle.next_to(arrow, DOWN + LEFT)

        circle2 = Circle()
        circle2.surround(rectangle, buffer_factor=1)

        ring = Annulus(inner_radius=.5, outer_radius=1, color=BLUE)
        ring.next_to(ellipse, RIGHT)

        self.add(pointer)
        self.add(circle2)
        self.play(FadeIn(square))
        self.play(Rotating(square), FadeIn(circle))
        self.play(GrowArrow(arrow))
        self.play(GrowFromCenter(rectangle), GrowFromCenter(ellipse),
                  GrowFromCenter(ring))

        self.wait()
示例#2
0
    def construct(self):
        eq1a = TexMobject("4x + 3y")
        eq1b = TexMobject("=")
        eq1c = TexMobject("0")

        eq2a = TexMobject("5x - 2y")
        eq2b = TexMobject("=")
        eq2c = TexMobject("3")

        eq1b.next_to(eq1a, RIGHT)
        eq1c.next_to(eq1b, RIGHT)

        eq2a.shift(DOWN)
        eq2b.shift(DOWN)
        eq2c.shift(DOWN)

        eq2a.align_to(eq1a, LEFT)
        eq2b.align_to(eq1b, LEFT)
        eq2c.align_to(eq1c, LEFT)

        eq_group = VGroup(eq1a, eq2a)
        braces = Brace(eq_group, LEFT)
        eq_text = braces.get_text("A pair of equations")

        self.play(Write(eq1a))
        self.play(Write(eq1b))
        self.play(Write(eq1c))
        self.play(Write(eq2a))
        self.play(Write(eq2b))
        self.play(Write(eq2c))
        self.play(GrowFromCenter(braces), Write(eq_text))

        self.wait(3)
示例#3
0
    def construct(self):
        eq1_text = "4 x + 3 y = 0".split()
        eq2_text = "5 x - 2 y = 3".split()

        eq1_mob = TexMobject(*eq1_text)
        eq2_mob = TexMobject(*eq2_text)

        color_map = {"x": RED_B, "y": GREEN_C}
        eq1_mob.set_color_by_tex_to_color_map(color_map)
        eq2_mob.set_color_by_tex_to_color_map(color_map)

        for eq1_item, eq2_item in zip(eq1_mob, eq2_mob):
            eq2_item.align_to(eq1_item, LEFT)

        eq1 = VGroup(*eq1_mob)
        eq2 = VGroup(*eq2_mob)
        eq2.shift(DOWN)

        eq_group = VGroup(eq1, eq2)
        braces = Brace(eq_group, LEFT)
        eq_text = braces.get_text("A pair of equations")

        self.play(Write(eq_text))
        self.play(GrowFromCenter(braces))
        self.play(Write(eq1), Write(eq2))
        self.wait(2)
示例#4
0
    def construct(self):
        circle = Circle()
        square = Square()
        line = Line((3, 0, 0), (5, 0, 0))
        triangle = Polygon((0, 0, 0), (1, 1, 0), (1, -1, 0))

        self.play(ShowCreation(circle), run_time=5)
        self.play(FadeOut(circle), GrowFromCenter(square))
        self.add(line)
        self.play(Transform(square, triangle))
        self.play(Transform(triangle))
        self.wait()
示例#5
0
    def construct(self):
        circle = Circle()
        square = Square()
        line = Line(np.array([3, 0, 0]), np.array([5, 0, 0]))
        triangle = Polygon(np.array([0, 0, 0]), np.array([1, 1, 0]),
                           np.array([1, -1, 0]))

        self.add(line)
        self.play(ShowCreation(circle))
        self.play(FadeOut(circle))
        self.play(GrowFromCenter(square))
        self.play(Transform(square, triangle))
        self.wait()
示例#6
0
    def make_axes(self):
        self.axes = Axes(x_min=-self.axes_scale * FRAME_X_RADIUS,
                         x_max=self.axes_scale * FRAME_X_RADIUS,
                         y_min=-self.axes_scale * FRAME_Y_RADIUS,
                         y_max=self.axes_scale * FRAME_Y_RADIUS,
                         x_axis_config={"include_ticks": False},
                         y_axis_config={"include_ticks": False},
                         number_line_config={"color": self.axes_color})
        self.axes_labels = self.axes.get_axis_labels(
            x_label_tex="E_x", y_label_tex="E_y").set_color(self.axes_color)

        self.play(
            AnimationGroup(GrowFromCenter(self.axes),
                           FadeIn(self.axes_labels),
                           lag_ratio=0.4))
示例#7
0
 def grow(self,
          *mobject_or_chars,
          run_time=1,
          pre_time=0.5,
          post_time=1,
          **kwargs):
     """
     if not isinstance(mobject_or_chars, (list,tuple,ndarray)):
         mobject_or_chars=[mobject_or_chars]
     mobject = Group(*[MobjectOrChars(each) for each in mobject_or_chars])
     """
     mobject = GroupedMobject(mobject_or_chars)
     keys = ["shift", "scale", "move_to"]
     [
         exec(
             "mobject." + key + "([" +
             ','.join(str(x) for x in kwargs.get(key)) + "])",
             {"mobject": mobject}) for key in keys if key in kwargs
     ]
     self.wait(pre_time)
     self.play(GrowFromCenter(mobject))
     self.wait(post_time)
     return self
示例#8
0
    def construct(self):
        if 1 == 1:
            try:
                self.add_sound(
                    "sidewayoutput\\basicmanim\\transform001b_01_01_02_01_01.wav",
                    time_offset=18)
                self.add_sound(
                    "sidewayoutput\\basicmanim\\transform001b_01_01_02_02_01.wav",
                    time_offset=48)
                self.add_sound(
                    "sidewayoutput\\basicmanim\\transform001b_01_01_02_02_02.wav",
                    time_offset=93)
                self.add_sound(
                    "sidewayoutput\\basicmanim\\transform001b_01_01_02_03_01.wav",
                    time_offset=148)
            except:
                pass
            self.play(
                StartScreens01(
                    [],
                    [],
                    [[r"\textbf{\textit{Basic-Manim from }\{Sideway\}}"],
                     [r"\textbf{\textit{Transform}}\\{Part\ \textspA{I}b}"],
                     [
                         r"\tiny{\textrm{basic-manim.210201951v0\_transform001b}}"
                     ], [],
                     [
                         r"\scriptsize{\textbf{Warning:\ The\ content\ may\ contain\ errors,\ mistakes\ and\ inaccuracies.\ Information\ must\ be\ verified\ and\ evaluated\ before\ use.}}"
                     ]],
                ))
        if 1 == 1:
            self.play(
                GrowFromCenter(
                    TextMobject(
                        r"\textit{\textbf{\underline{Apply\ Transform}}}").
                    shift([0, 3.6, 0])))
            rows, cols = (7, 3)
            x = 5.
            x0, y0 = axes_point([-2.5, x, cols - 1, -5],
                                [2., -1.1, rows - 1, 3])
            txtx = ["\\underline{state 1}", "\\underline{state 2}"]
            txty = ["Method", "ApplyMethod", "ApplyFunction"]

            a1 = [
                "\\normalsize{sq[0]}", "\\normalsize{sq[1]}",
                "\\normalsize{sq[2]}"
            ]
            a2 = [
                r"\normalsize{sq[0]\\.shift([" + str(x) + r",\,0,\,0])}",
                r"\normalsize{ApplyMethod(\\sq[1].shift,\,[" + str(x) +
                r",\,0,\,0])}",
                r"\normalsize{ApplyFunction(\\lambda\,mob:\,mob.shift([" +
                str(x) + r",\,0,\,0]),\,sq[2])}"
            ]
            sq = [GeomSquare(0.75) for i in range(3)]

            self.fadein(
                *[
                    TextMobject(txtx[i]).move_to(each)
                    for i, each in enumerate(coord_grid(x0[1:], y0[0:1]))
                ],
                *[
                    TextMobject(txty[i]).move_to(each)
                    for i, each in enumerate(coord_grid(x0[0:1], y0[1::2]))
                ],
                *[GeomPoint(each) for each in coord_grid(x0[1:3], y0[2::2])],
                *[
                    MobjectOrChars(np.ravel(list(zip(a1,
                                                     a2)))[i]).move_to(each)
                    for i, each in enumerate(coord_grid(x0[1:3], y0[1::2]))
                ],
                *[
                    sq[i].move_to(each)
                    for i, each in enumerate(coord_grid(x0[1:2], y0[2::2]))
                ],
                run_time=5)
            self.play(AnimationGroup(
                ShowCreation(sq[0].shift([x, 0, 0]), run_time=0),
                ApplyMethod(sq[1].shift, [x, 0, 0]),
                ApplyFunction(lambda mob: mob.shift([x, 0, 0]), sq[2])),
                      run_time=15)
            self.fadeout()
        if 1 == 1:
            self.play(
                GrowFromCenter(
                    TextMobject(
                        r"\textit{\textbf{\underline{Apply Method}}}").shift(
                            [0, 3.6, 0]).add_as_foreground(self)))
            rows, cols = (8, 2)
            x0, y0 = axes_point([-1.5, 6, cols], [3, -0.9, rows])
            txty = [
                MobjectOrChars(each) for each in [
                    r"FadeToColor(sq[0],\,RED)", r"ScaleInPlace(sq[1],\,0.5))",
                    "ShrinkToCenter(sq[2])", "Restore(sq[3])"
                ]
            ]
            a1 = [
                MobjectOrChars("\\normalsize{sq[" + str(i) + "]}")
                for i in range(4)
            ]
            sq = [GeomSquare(0.75) for i in range(4)]
            self.fadein(
                *[
                    to_get_zlist(a1, sq)[i].move_to(each)
                    for i, each in enumerate(coord_grid(x0[1:2], y0))
                ],
                *[GeomPoint(each) for each in coord_grid(x0[1:2], y0[1::2])],
            )
            self.wait()
            sq[3].save_state()
            self.play(AnimationGroup(
                IndicateThenFadeOut(TextMobject(
                    r"Transform(sq[3], Circle().scale(0.375).\\move\_to(sq[3]).shift([1, 0, 0])))"
                ).move_to([x0[0], y0[7], 0]),
                                    scale_factor=1,
                                    ratio_array=[1, 0]),
                Transform(
                    sq[3],
                    Circle().scale(0.375).move_to(sq[3]).shift([1, 0, 0]))),
                      run_time=5)
            self.wait()
            self.fadein(
                *[
                    txty[i].move_to(each)
                    for i, each in enumerate(coord_grid(x0[0:1], y0[1::2]))
                ], )
            self.play(AnimationGroup(
                FadeToColor(sq[0], RED),
                ScaleInPlace(sq[1], 0.5),
                ShrinkToCenter(sq[2]),
                Restore(sq[3]),
            ),
                      run_time=35)
            self.fadeout(exclude_mobjs="foreground")
        if 1 == 1:
            rows, cols = (6, 2)
            x0, y0 = axes_point([-1.5, 6, cols], [3, -0.9, rows])
            txty = [
                MobjectOrChars(each) for each in [
                    r"ApplyPointwiseFunction(\\lambda\,pointarray:\,pointarray\,+\,[1,\,0,\,0],\,sq[0])",
                    r"ApplyMatrix([[1.23,\,0.9],\,[0,\,1]],\,sq[1])",
                    r"ApplyComplexFunction(lambda pointarray:\\pointarray\,+\,np.complex(1,\,0),\,sq[2])",
                ]
            ]
            a1 = [
                MobjectOrChars("\\normalsize{sq[" + str(i) + "]}")
                for i in range(4)
            ]
            sq = [GeomSquare(0.75) for i in range(4)]
            self.fadein(
                *[
                    to_get_zlist(a1, sq)[i].move_to(each)
                    for i, each in enumerate(coord_grid(x0[1:2], y0))
                ],
                *[GeomPoint(each) for each in coord_grid(x0[1:2], y0[1::2])],
            )
            self.wait()
            self.fadein(
                *[
                    txty[i].move_to(each)
                    for i, each in enumerate(coord_grid(x0[0:1], y0[1::2]))
                ], )
            self.play(AnimationGroup(
                ApplyPointwiseFunction(
                    lambda pointarray: pointarray + [1, 0, 0], sq[0]),
                ApplyMatrix([[1.23, 0.9], [0, 1]], sq[1]),
                ApplyComplexFunction(
                    lambda pointarray: pointarray + np.complex(1, 0), sq[2]),
            ),
                      run_time=45)
            self.fadeout()
        if 1 == 1:
            self.play(
                GrowFromCenter(
                    TextMobject(
                        r"\textit{\textbf{\underline{Swap Method}}}").shift(
                            [0, 3.6, 0])))
            rows, cols = (2, 2)
            count = m, n = [2, 6]
            x0, y0 = axes_point([-3.5, 6, cols], [2.4, -3.7, rows])
            geometrys = [GeomLine(), GeomRegularPolygon(n, radius=2)]
            txty = [
                MobjectOrChars(each) for each in [
                    r"Swap(*sqs)\\ \tiny{(same as CyclicReplace)}",
                    r"CyclicReplace(*sqs)",
                ]
            ]
            titles = [
                [
                    MobjectOrChars("\\normalsize{sq[" + str(i) + "]}")
                    for i in range(m)
                ],
                [
                    MobjectOrChars("\\normalsize{sq[" + str(i) + "]}")
                    for i in range(n)
                ],
            ]
            sqs = [
                [GeomSquare(1.) for i in range(m)],
                [GeomSquare(1.) for i in range(n)],
            ]
            [[
                sq.add(title).add(GeomPoint())
                for sq, title in zip(sqs[i], titles[i])
            ] for i in range(len(count))]
            self.fadein(*[
                geometrys[i].move_to(each)
                for i, each in enumerate(coord_grid(x0[1:], y0[0:]))
            ])
            self.fadein(*[
                Group(*[
                    sqs[j][i].move_to(each) for i, each in enumerate(
                        geometrys[j].get_counting_points())
                ]) for j in range(2)
            ])
            self.fadein(
                *[
                    txty[i].move_to(each)
                    for i, each in enumerate(coord_grid(x0[0:1], y0[0:]))
                ], )
            self.play(AnimationGroup(
                Swap(*sqs[0]),
                CyclicReplace(*sqs[1]),
            ),
                      run_time=35)
            self.fadeout()
        if 1 == 1:
            self.play(EndScreen01())
        self.wait(5)
示例#9
0
 def init_animation(self):
     circle_animations = []
     for node in self.nodes:
         self.add(node.text)
         circle_animations.append(GrowFromCenter(node.circle))
     self.play(*circle_animations)
示例#10
0
 def construct(self):
     if 1 == 1:
         try:
             self.add_sound(
                 "sidewayoutput\\basicmanim\\geometry001a_01_01_01_01_01.wav",
                 time_offset=20)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\geometry001a_01_01_01_02_01.wav",
                 time_offset=68)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\geometry001a_01_01_01_02_02.wav",
                 time_offset=87)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\geometry001a_01_01_01_02_03.wav",
                 time_offset=100)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\geometry001a_01_01_01_03_01.wav",
                 time_offset=115)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\geometry001a_01_01_01_03_02.wav",
                 time_offset=131)
         except:
             pass
         self.play(
             StartScreens01(
                 [],
                 [],
                 [[r"\textbf{\textit{Basic-Manim from }\{Sideway\}}"],
                  [r"\textbf{\textit{Geometry}}\\{{Part\ \textspA{I}a}"],
                  [
                      r"\tiny{\textrm{basic-manim.210301551v0\_geometry001a}}"
                  ], [],
                  [
                      r"\scriptsize{\textbf{Warning:\ The\ content\ may\ contain\ errors,\ mistakes\ and\ inaccuracies.\ Information\ must\ be\ verified\ and\ evaluated\ before\ use.}}"
                  ]],
             ))
     if 1 == 1:
         self.grow(r"\titleA{Geometry}", shift=[0, 3.6, 0])
         rows, cols = (10, 6)
         x0, y0 = axes_point([-5.5, 2.3, cols], [3, -0.7, rows])
         txty = [
             "TipableVMobject()", "Arc(radius=0.5)",
             "ArcBetweenPoints(LO,RO)", "CurvedArrow(LO,RO)",
             "CurvedDoubleArrow(LO,RO)", "Circle(radius=0.5)", "Dot()",
             "SmallDot()", "Ellipse()",
             "Annulus(inner_radius=0.25,outer_radius=0.5)",
             "AnnularSector(inner_radius=0.25,outer_radius=0.5)",
             "Sector(outer_radius=0.5)", "Line()", "DashedLine()",
             "TangentLine(Circle(),0)", "Arrow()", "Vector()",
             "DoubleArrow()", "Elbow()", "CubicBezier([RO,RU/2,LU/2,LO])",
             "Polygon(RO,RU/2,LU/2,LO)", "RegularPolygon().scale(0.5)",
             "Triangle().scale_about_point(0.5,[0,0,0])", "ArrowTip()",
             "Rectangle().scale(0.5)", "Square().scale(0.5)",
             "RoundedRectangle().scale(0.5)", "TipableVMobject()",
             "TipableVMobject()", "TipableVMobject()"
         ]
         strs = txty
         self.grow(
             *[
                 GeomPoint().move_to(each)
                 for i, each in enumerate(coord_grid(x0[:], y0[1::2])[:-3])
             ], )
         txty = [
             "TextMobject('" + txty[i].split('(', 1)[0] +
             "').scale(0.55).move_to([" + ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[:], y0[0::2]))
         ]
         strs = [
             strs[i] + ".shift([" + ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[:], y0[1::2]))
         ]
         strs = [j for i in zip(txty, strs) for j in i][:-6]
         exec("self.create(" + ','.join(strs) +
              ", run_time=42, lag_ratio=1)")
         self.fadeout()
     if 1 == 1:
         self.play(
             GrowFromCenter(
                 TextMobject(r"\titleA{TipableVMobject(VMobject)}").shift(
                     [0, 3.6, 0]).add_as_foreground(self)))
         rows, cols = (5, 3)
         x0, y0 = axes_point([1.1, 4.5, cols - 1, -4.5], [2.5, -1.2, rows])
         txty = [
             "TipableVMobject()", "Arc(radius = 0.5)",
             "ArcBetweenPoints(LO,RO)", "CurvedArrow(LO,RO)",
             r"\parbox{25em}{CurvedDoubleArrow(\bR{LO,RO)"
         ]
         strs = txty
         self.fadein(*[
             TextMobject(txty[i].split('(', 1)[0]).move_to(each)
             for i, each in enumerate(coord_grid(x0[0:1], y0))
         ],
                     run_time=5)
         self.grow(
             *[
                 TextMobject(strs[i]).move_to(each)
                 for i, each in enumerate(coord_grid(x0[1:2], y0))
             ],
             *[
                 GeomPoint().move_to(each)
                 for i, each in enumerate(coord_grid(x0[2:3], y0))
             ],
         )
         strs = [
             strs[i].replace("\\bR{", "").replace(
                 "\\parbox{25em}{", "").replace("\\", "") + ".shift([" +
             ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[2:3], y0))
         ]
         exec("self.create(" + ','.join(strs) +
              ", run_time=10, lag_ratio=0)")
         self.fadeout(exclude_mobjs="foreground")
     if 1 == 1:
         rows, cols = (7, 3)
         x0, y0 = axes_point([1.1, 4.5, cols - 1, -4.5], [3, -1.1, rows])
         txty = [
             "Circle(radius = 0.5)", "Dot()", "SmallDot()", "Ellipse()",
             r"\parbox{25em}{Annulus(inner\_radius = 0.25, \bR{outer\_radius = 0.5)",
             r"\parbox{25em}{AnnularSector(inner\_radius\bR{= 0.25, outer\_radius = 0.5)",
             r"Sector(outer\_radius = 0.5)"
         ]
         strs = txty
         self.fadein(*[
             TextMobject(txty[i].split('(', 1)[0]).move_to(each)
             for i, each in enumerate(coord_grid(x0[0:1], y0))
         ],
                     run_time=5)
         self.grow(
             *[
                 TextMobject(strs[i]).move_to(each)
                 for i, each in enumerate(coord_grid(x0[1:2], y0))
             ],
             *[
                 GeomPoint().move_to(each)
                 for i, each in enumerate(coord_grid(x0[2:3], y0))
             ],
         )
         strs = [
             strs[i].replace("\\bR{", "").replace(
                 "\\parbox{25em}{", "").replace("\\", "") + ".shift([" +
             ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[2:3], y0))
         ]
         exec("self.create(" + ','.join(strs) +
              ", run_time=6, lag_ratio=0)")
         self.fadeout(exclude_mobjs="foreground")
     if 1 == 1:
         rows, cols = (6, 3)
         x0, y0 = axes_point([1.1, 4.5, cols - 1, -4.5], [3, -1.1, rows])
         txty = [
             "Line()", "DashedLine()", "TangentLine(Circle(), 0)",
             "Arrow()", "Vector()", "DoubleArrow()"
         ]
         strs = txty
         self.fadein(*[
             TextMobject(txty[i].split('(', 1)[0]).move_to(each)
             for i, each in enumerate(coord_grid(x0[0:1], y0))
         ],
                     run_time=5)
         self.grow(
             *[
                 TextMobject(strs[i]).move_to(each)
                 for i, each in enumerate(coord_grid(x0[1:2], y0))
             ],
             *[
                 GeomPoint().move_to(each)
                 for i, each in enumerate(coord_grid(x0[2:3], y0))
             ],
         )
         strs = [
             strs[i].replace("\\bR{", "").replace(
                 "\\parbox{25em}{", "").replace("\\", "") + ".shift([" +
             ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[2:3], y0))
         ]
         exec("self.create(" + ','.join(strs) +
              ", run_time=5, lag_ratio=0)")
         self.fadeout()
     if 1 == 1:
         self.play(
             GrowFromCenter(
                 TextMobject(r"\titleA{VMobject}").shift(
                     [0, 3.6, 0]).add_as_foreground(self)))
         rows, cols = (3, 3)
         x0, y0 = axes_point([1.1, 4.5, cols - 1, -4.5], [3, -1.1, rows])
         txty = [
             "Elbow()",
             r"\parbox{25em}{CubicBezier(\bR{[RO, RU/2, LU/2, LO])",
             r"\parbox{25em}{Polygon(\bR{RO, RU/2, LU/2, LO)"
         ]
         strs = txty
         self.fadein(*[
             TextMobject(txty[i].split('(', 1)[0]).move_to(each)
             for i, each in enumerate(coord_grid(x0[0:1], y0))
         ],
                     run_time=5)
         self.grow(
             *[
                 TextMobject(strs[i]).move_to(each)
                 for i, each in enumerate(coord_grid(x0[1:2], y0))
             ],
             *[
                 GeomPoint().move_to(each)
                 for i, each in enumerate(coord_grid(x0[2:3], y0))
             ],
         )
         strs = [
             strs[i].replace("\\bR{", "").replace(
                 "\\parbox{25em}{", "").replace("\\", "") + ".shift([" +
             ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[2:3], y0))
         ]
         exec("self.create(" + ','.join(strs) +
              ", run_time=7, lag_ratio=0)")
         self.fadeout(exclude_mobjs="foreground")
     if 1 == 1:
         rows, cols = (6, 3)
         x0, y0 = axes_point([1.1, 4.5, cols - 1, -4.5], [3, -1.1, rows])
         txty = [
             "RegularPolygon().scale(0.5)",
             r"\parbox{25em}{Triangle().scale\_about\_point(\bR{0.5, [0, 0, 0])",
             "ArrowTip()", "Rectangle().scale(0.5)", "Square().scale(0.5)",
             r"\parbox{25em}{RoundedRectangle()\bR{.scale(0.5)"
         ]
         strs = txty
         self.fadein(*[
             TextMobject(txty[i].split('(', 1)[0]).move_to(each)
             for i, each in enumerate(coord_grid(x0[0:1], y0))
         ],
                     run_time=5)
         self.grow(
             *[
                 TextMobject(strs[i]).move_to(each)
                 for i, each in enumerate(coord_grid(x0[1:2], y0))
             ],
             *[
                 GeomPoint().move_to(each)
                 for i, each in enumerate(coord_grid(x0[2:3], y0))
             ],
         )
         strs = [
             strs[i].replace("\\bR{", "").replace(
                 "\\parbox{25em}{", "").replace("\\", "") + ".shift([" +
             ','.join(map(str, each)) + "])"
             for i, each in enumerate(coord_grid(x0[2:3], y0))
         ]
         exec("self.create(" + ','.join(strs) +
              ", run_time=9, lag_ratio=0)")
         self.fadeout()
     if 1 == 1:
         self.play(EndScreen01())
     self.wait(5)
示例#11
0
 def construct(self):
     if 1 == 1:
         try:
             self.add_sound(
                 "sidewayoutput\\basicmanim\\transform001a_01_01_01_01_01.wav",
                 time_offset=18)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\transform001a_01_01_01_02_01.wav",
                 time_offset=93)
             self.add_sound(
                 "sidewayoutput\\basicmanim\\transform001a_01_01_01_03_01.wav",
                 time_offset=135)
         except:
             pass
         self.play(
             StartScreens01(
                 [],
                 [],
                 [[r"\textbf{\textit{Basic-Manim from }\{Sideway\}}"],
                  [r"\textbf{\textit{Transform}}\\{{Part\ \textspA{I}a}"],
                  [
                      r"\tiny{\textrm{basic-manim.210200551v0\_transform001a}}"
                  ], [],
                  [
                      r"\scriptsize{\textbf{Warning:\ The\ content\ may\ contain\ errors,\ mistakes\ and\ inaccuracies.\ Information\ must\ be\ verified\ and\ evaluated\ before\ use.}}"
                  ]],
             ))
     if 1 == 1:
         self.play(
             GrowFromCenter(
                 TextMobject(
                     r"\textit{\textbf{\underline{Transform}}}").shift(
                         [0, 3.6, 0])))
         squarea = Square()
         squareb = Square(side_length=4).shift([4, 0, 0])
         circlea = Circle()
         circleb = Circle(radius=2).shift([-4, 0, 0])
         linea = Line([-4, 3, 0], [4, 3, 0])
         lineb = Line([-3, -3, 0], [3, -3, 0])
         texta = TextMobject("AB").shift([0, -2.5, 0])
         textb = TextMobject("HI").shift([0, 2.5, 0])
         self.play(
             ShowCreation(Group(squarea, circlea, squareb, circleb, linea,
                                lineb),
                          lag_ratio=1,
                          run_time=12))
         self.play(Write(VGroup(texta, textb), lag_ratio=1, run_time=10))
         self.play(Transform(circlea, squarea, run_time=5))
         self.play(Transform(circlea, squareb, path_arc=3, run_time=5))
         self.play(Transform(squarea, circleb, path_arc=3, run_time=5))
         self.play(Transform(linea, lineb, path_arc=3, run_time=5))
         self.play(Transform(linea, circleb, path_arc=3, run_time=5))
         self.play(Transform(squareb, lineb, path_arc=3, run_time=5))
         self.play(Transform(texta, textb, path_arc=3, run_time=5))
         self.play(Transform(texta, circleb, path_arc=3, run_time=5))
         self.play(Transform(squareb, textb, path_arc=3, run_time=5))
         self.fadeout()
     if 1 == 1:
         self.play(
             GrowFromCenter(
                 TextMobject(
                     r"\textit{\textbf{\underline{Paths\ of\ Transform}}}").
                 shift([0, 3.6, 0])))
         rows, cols = (7, 5)
         x0, y0 = axes_point([0, 2, cols - 1, -4], [2.3, -1, rows - 1, 3])
         txtx = ["loc 1", "loc 2", "m1", "m2"]
         txty = [
             "ClockwiseTransform", "Transform", "CounterclockwiseTransform"
         ]
         a1 = Group()
         a2 = Group()
         a3 = Group()
         a4 = Group()
         for j in range(1, rows):
             a1.add(Circle().scale(0.2).move_to([x0[1], y0[j], 0]))
             a2.add(Square().scale(0.2).move_to([x0[2], y0[j], 0]))
             a3.add(
                 Dot([x0[3], y0[j], 0]).add_updater(lambda mob, obj=a1[
                     j - 1], x=x0[3], y=y0[j]: mob.become(obj.copy(
                     ).move_to([x, y, 0]))).suspend_updating())
             a4.add(
                 Dot([x0[4], y0[j], 0]).add_updater(lambda mob, obj=a2[
                     j - 1], x=x0[4], y=y0[j]: mob.become(obj.copy(
                     ).move_to([x, y, 0]))).suspend_updating())
         self.play(FadeIn(
             Group(
                 *[
                     TextMobject(txtx[i]).move_to(each)
                     for i, each in enumerate(coord_grid(x0[1:], y0[0:1]))
                 ], *[
                     TextMobject(txty[i]).move_to(each)
                     for i, each in enumerate(coord_grid(x0[0:1], y0[1::2]))
                 ], *[Dot(each) for each in coord_grid(x0[1:3], y0[1:])],
                 TextMobject(r"$\rightarrow$").move_to(
                     ([(x0[1] + x0[2]) / 2, y0[0], 0])), a1[::2], a2[::2],
                 a3, a4, *[
                     Square(stroke_width=2,
                            color="#FFFF00",
                            fill_opacity=0.3).add_updater(
                                lambda mob, obj=obj: mob.surround(
                                    obj, stretch=True, buff=0.2))
                     for obj in a1
                 ], *[
                     Square(stroke_width=2, color="#DC75CD").add_updater(
                         lambda mob, obj=obj: mob.surround(
                             obj, stretch=True, buff=0.3)) for obj in a2
                 ])),
                   run_time=5)
         self.wait(2)
         self.play(AnimationGroup(
             ClockwiseTransform(a2[0], a1[0]),
             ClockwiseTransform(a1[1], a2[1]),
             Transform(a1[2], a2[2]),
             Transform(a2[3], a1[3]),
             CounterclockwiseTransform(a1[4], a2[4]),
             CounterclockwiseTransform(a2[5], a1[5]),
         ),
                   run_time=25)
         self.wait(3)
         a1.shift([0.3, 0, 0]).set_color("#11FF00")
         self.wait(3)
         self.play(ApplyMethod(a1.shift, ([0.3, 0, 0])), run_time=3)
         self.fadeout()
     if 1 == 1:
         self.play(
             GrowFromCenter(
                 TextMobject(
                     r"\textit{\textbf{\underline{Methods\ of\ Transform}}}"
                 ).shift([0, 3.6, 0])))
         rows, cols = (9, 5)
         x0, y0 = axes_point([0, 2, cols - 1, -4], [2.3, -0.8, rows - 1, 3])
         txtx = ["loc 1", "loc 2", "m1", "m2"]
         txty = [
             "Transform", "ReplacementTransform", "TransformFromCopy",
             "MoveToTarget"
         ]
         a1 = Group()
         a2 = Group()
         a3 = Group()
         a4 = Group()
         for j in range(1, rows):
             a1.add(Circle().scale(0.2).move_to([x0[1], y0[j], 0]))
             a2.add(Square().scale(0.2).move_to([x0[2], y0[j], 0]))
             a3.add(Dot().move_to([x0[3], y0[j], 0]).add_updater(
                 lambda mob, obj=a1[j - 1], x=x0[3], y=y0[j]: mob.become(
                     obj.copy().move_to([x, y, 0]))).suspend_updating())
             a4.add(Dot().move_to([x0[4], y0[j], 0]).add_updater(
                 lambda mob, obj=a2[j - 1], x=x0[4], y=y0[j]: mob.become(
                     obj.copy().move_to([x, y, 0]))).suspend_updating())
         a1[6].target = a2[6]
         a1[7].target = a2[7]
         self.play(FadeIn(
             Group(
                 *[
                     TextMobject(txtx[i]).move_to(each)
                     for i, each in enumerate(coord_grid(x0[1:], y0[0:1]))
                 ], *[
                     TextMobject(txty[i]).move_to(each)
                     for i, each in enumerate(coord_grid(x0[0:1], y0[1::2]))
                 ], *[Dot(each) for each in coord_grid(x0[1:3], y0[1:])],
                 TextMobject(r"$\rightarrow$").move_to(
                     ([(x0[1] + x0[2]) / 2, y0[0], 0])), a1[::2], a2[::2],
                 a3, a4,
                 Group(*[
                     Square(
                         stroke_width=2, color="#FFFF00", fill_opacity=0.3).
                     add_updater(lambda mob, obj=obj: mob.surround(
                         obj, stretch=True, buff=0.2)) for obj in a1
                 ]),
                 Group(*[
                     Square(stroke_width=2, color="#DC75CD").add_updater(
                         lambda mob, obj=obj: mob.surround(
                             obj, stretch=True, buff=0.3)) for obj in a2
                 ]))),
                   run_time=5)
         self.wait(2)
         self.play(AnimationGroup(Transform(a1[0], a2[0]),
                                  Transform(a1[1], a2[1]),
                                  ReplacementTransform(a1[2], a2[2]),
                                  ReplacementTransform(a1[3], a2[3]),
                                  TransformFromCopy(a1[4], a2[4]),
                                  TransformFromCopy(a1[5], a2[5]),
                                  MoveToTarget(a1[6]), MoveToTarget(a1[7])),
                   run_time=40)
         self.wait(3)
         a1.shift([0.3, 0, 0]).set_color("#11FF00")
         self.wait(10)
         self.play(ApplyMethod(a1.shift, ([0.3, 0, 0])), run_time=5)
         self.fadeout()
     if 1 == 1:
         self.play(EndScreen01())
     self.wait(5)
示例#12
0
    def construct(self):
        shape = Ellipse(fill_color=BLUE, fill_opacity=1)
        brace = Brace(shape, LEFT)

        self.play(Write(shape), GrowFromCenter(brace))
        self.wait(2)
    def construct(self):
        self._main_title()

        text_one = TextMobject("Given a list of items sold")
        text_two: TextMobject = TextMobject(
            "Randomly choose items matching this distribution")
        text_two.next_to(text_one, DOWN)
        number_line = NumberLine(
            numbers_with_elongated_ticks=[0, 1],
            include_numbers=True,
            x_min=0,
            x_max=1,
            unit_size=10,
            tick_frequency=0.1,
            # decimal_number_config={"num_decimal_places": 1},
            numbers_to_show=[0, 1])
        number_line.next_to(text_two, UP)

        self.play(ShowCreation(text_one))
        self.wait()
        self.play(ShowCreation(text_two))
        self.wait(4)

        apples_text = TextMobject("Apples:")
        apples_text.set_color(self._apple_colour)

        apples_text.to_edge(UP)
        apples_text.align_to(text_two, LEFT)

        apple_count_text = TextMobject(f"{self._apple_count}")
        apple_count_text.set_color(self._apple_colour)
        apple_count_text.next_to(apples_text, RIGHT)

        banana_text = TextMobject("Bananas:")
        banana_text.set_color(self._banana_colour)

        banana_text.next_to(apples_text, DOWN)
        banana_text.align_to(apples_text, LEFT)

        banana_count_text = TextMobject(f"{self._banana_count}")
        banana_count_text.set_color(self._banana_colour)
        banana_count_text.next_to(banana_text, RIGHT)

        self.play(Transform(text_one, apples_text))
        self.play(ShowCreation(apple_count_text))
        self.play(ShowCreation(banana_text), ShowCreation(banana_count_text))

        banana_bar = Rectangle(
            height=0.4,
            width=number_line.point_to_number(self._banana_fraction * 10) *
            (number_line.number_to_point(1)[0]),
            color=self._banana_colour,
            fill_color=self._banana_colour,
            fill_opacity=0.75)
        banana_bar.next_to(banana_count_text, RIGHT + RIGHT)

        apple_bar = Rectangle(
            height=0.4,
            width=number_line.point_to_number(self._apple_fraction * 10) *
            (number_line.number_to_point(1)[0]),
            color=self._apple_colour,
            fill_color=self._apple_colour,
            fill_opacity=0.75)
        apple_bar.next_to(banana_bar, UP)
        apple_bar.align_to(banana_bar, LEFT)

        self.play(FadeIn(apple_bar), FadeIn(banana_bar))

        self.wait(1.5)

        apple_fraction_text = TextMobject("$\\frac{" + str(self._apple_count) +
                                          "}{" + str(self._apple_count +
                                                     self._banana_count) +
                                          "} = " + str(self._apple_fraction) +
                                          "$")
        apple_fraction_text.next_to(apple_bar, RIGHT)

        banana_fraction_text = TextMobject("$\\frac{" +
                                           str(self._banana_count) + "}{" +
                                           str(self._apple_count +
                                               self._banana_count) + "} = " +
                                           str(self._banana_fraction) + "$")
        banana_fraction_text.next_to(banana_bar, RIGHT)

        self.play(ShowCreation(apple_fraction_text))
        self.play(ShowCreation(banana_fraction_text))

        self.wait(2)

        number_line_map_text = TextMobject(
            "Map these counts to values between 0 and 1")
        number_line_map_text.next_to(text_two, UP)
        self.play(ShowCreation(number_line_map_text))

        self.wait(3)
        self.play(Transform(number_line_map_text, number_line))

        apple_num_ln_bar = Rectangle(
            height=0.4,
            # width=1 - self._apple_fraction * (number_line.number_to_point(1)[0]),
            width=number_line.point_to_number(self._apple_fraction * 10) *
            (number_line.number_to_point(1)[0]),
            color=self._apple_colour,
            fill_color=self._apple_colour,
            fill_opacity=0.25)
        apple_num_ln_bar.move_to(apple_bar, LEFT)
        self.add(apple_num_ln_bar)
        self.wait(2)
        self.play(
            ApplyMethod(apple_num_ln_bar.move_to,
                        number_line.number_to_point(0), LEFT))

        banana_num_ln_bar = Rectangle(
            height=0.4,
            width=number_line.point_to_number(self._banana_fraction * 10) *
            (number_line.number_to_point(1)[0]),
            color=self._banana_colour,
            fill_color=self._banana_colour,
            fill_opacity=0.25)
        banana_num_ln_bar.move_to(banana_bar, LEFT)
        self.add(banana_num_ln_bar)
        self.wait(2)
        self.play(
            ApplyMethod(banana_num_ln_bar.move_to,
                        number_line.number_to_point(1), RIGHT))

        text_scale: float = 0.75
        get_rnd_full = TextMobject(
            "Get a random number $n$ between 0 and 1 (uniform distribution)")

        get_apple_text = TextMobject(
            f"Apple\\quad if $n <= {self._apple_fraction}$",
            tex_to_color_map={"Apple": self._apple_colour})
        get_banana_text = TextMobject(
            f"Banana\\quad if $n > {self._apple_fraction}$",
            tex_to_color_map={"Banana": self._banana_colour})

        get_rnd_full.scale(text_scale)
        get_rnd_full.next_to(text_two, DOWN)
        get_banana_text.next_to(get_apple_text, DOWN)
        step_group = VGroup(get_apple_text, get_banana_text)

        brace = Brace(step_group, LEFT)
        step_text_d = brace.get_text("$n \\sim U(0, 1)$")
        step_text_d.scale(text_scale)
        step_text_d.next_to(get_rnd_full, DOWN + DOWN)
        step_text_d.shift(LEFT)
        brace.next_to(step_text_d, RIGHT)

        step_group.scale(text_scale)
        step_group.next_to(step_text_d, RIGHT + RIGHT + RIGHT)

        self.wait(2)
        self.play(ShowCreation(get_rnd_full))
        self.wait(2)
        self.play(ShowCreation(step_text_d))
        self.wait(2)

        self.play(GrowFromCenter(brace))
        self.wait()
        self.play(ShowCreation(get_apple_text))
        self.wait(2)
        self.play(ShowCreation(get_banana_text))

        # random_nos_to_draw = 10
        # main_arrow = Arrow(ORIGIN, DOWN * 1.3)
        # helper_arrow = Arrow(ORIGIN, LEFT * 1.3)
        #
        # for i in range(random_nos_to_draw):
        #   num: float = np.random.random_sample(1)
        #   point = number_line.number_to_point(num)
        #   arrow_colour = self._apple_colour if num <= self._apple_fraction else self._banana_colour
        #   arrow_recipient = get_apple_text if num <= self._apple_fraction else get_banana_text
        #
        #   main_arrow.set_color(arrow_colour)
        #
        #   if i == 0:
        #     main_arrow.next_to(point, UP)
        #     helper_arrow.next_to(arrow_recipient, RIGHT)
        #     self.play(GrowArrow(main_arrow), GrowArrow(helper_arrow))
        #   else:
        #     self.play(ApplyMethod(helper_arrow.next_to, arrow_recipient, RIGHT),
        #               ApplyMethod(main_arrow.next_to, point, UP))
        #   self.wait()
        #
        # self.play(FadeOut(main_arrow), FadeOut(helper_arrow))
        self.wait()
示例#14
0
    def __init__(self,
                 screen01=[],
                 screen02=[],
                 screen03=[],
                 lag_ratio=1,
                 **kwargs):
        mobjs_1, mobjs_1_scale, mobjs_1_interval, mobjs_1_rate_func, \
            title_1, title_1_color, title_1_scale, title_1_position, title_1_shadow, \
            title_1_indicate_scale_factor, title_1_extra = screen01 + \
            ["", 2, 0.5, linear, "", "#0808B8", 2, [DOWN], [2, slice(0, 3, 2)],
             1.2, ""][len(screen01):]
        mobjs_2, mobjs_2_scale, mobjs_2_interval, mobjs_2_rate_func, \
            title_2, title_2_color, title_2_scale, title_2_position, title_2_shadow, \
            title_2_indicate_scale_factor, title_2_extra = screen02 + \
            ["", 2, 0.5, linear, "", "#0808B8", 1.2, [DOWN], [2, slice(1, 4, 2)],
             "", [slice(1, 2), WHITE, [-2.5, 0, 0]]][len(screen02):]
        [title, subtitle, filename, reference, warning, mobjes_3_run_time] =\
            screen03 + [[], [], [], [], [], 3][len(screen03):]
        [title, title_color, title_scale, title_position] = title + \
            ["", WHITE, 1, [UP]][len(title):]
        [subtitle, subtitle_color, subtitle_scale, subtitle_position] = subtitle + \
            ["", WHITE, 1, [0, 0, 0]][len(subtitle):]
        [filename, filename_color, filename_scale, filename_position] = filename + \
            ["", WHITE, 1, [0, -2.9, 0]][len(filename):]
        [reference, reference_color, reference_scale, reference_position] = reference + \
            ["", YELLOW, 1, [0, -3.3, 0]][len(reference):]
        [warning, warning_color, warning_scale, warning_position] = warning + \
            ["", YELLOW, 1, [0, -3.7, 0]
             ][len(warning):]

        startscreens = AGroup()
        if mobjs_1 != None:
            if mobjs_1 == "":
                try:
                    mobjs_1 = ImageMobjectGroup(
                        np.char.mod('%01d', range(0, 10)),
                        "sidewayoutput\\sidewayoutput2020yt")
                except:
                    mobjs_1 = ImageMobjectGroup(
                        np.char.mod('%01d', range(9, -1, -1)), "001\\")
            if title_1 == "":
                title_1 = PoweredBy
            title_1 = MobjectOrChars(title_1)
            title_1.set_color(title_1_color).scale(
                title_1_scale).align_on_border(
                    *title_1_position).add_shadow_mobjects(
                        title_1_shadow[0], title_1[title_1_shadow[1]])
            if title_1_extra != "":
                title_1[title_1_extra[0]].set_color(title_1_extra[1]).shift(
                    title_1_extra[2])
            if title_1_indicate_scale_factor == "":
                title_width = mobjs_1.get_width()
                title_1_indicate_scale_factor = (title_width -
                                                 0.5) / title_width
            startscreens.add(
                ShowSubmobjectsOneByOneAndFadeInThenIndicateThenFadeOut(
                    mobjs_1.scale(mobjs_1_scale),
                    title_1,
                    indicate_scale_factor=title_1_indicate_scale_factor,
                    show_rate_func=mobjs_1_rate_func,
                    run_time=mobjs_1_interval * (len(mobjs_1)),
                    **kwargs))
        if mobjs_2 != None:
            if mobjs_2 == "":
                strs = TextMobject(r"\textspA{%s}" % Project)
                mobjs_2 = Group(
                    Circle(fill_opacity=0.75),
                    RegularPolygon(fill_opacity=0.75),
                    Triangle(color=GREEN, fill_opacity=0.75),
                    Square(fill_opacity=0.75),
                    strs.set_color("#FFFFFF"),
                    strs.copy().set_color("#F8F8F8").scale(1.3),
                    strs.copy().set_color("#F8F8B8").scale(1.6),
                    strs.copy().set_color("#B8B8B8").scale(1.6),
                    strs.copy().set_color("#8888B8").scale(1.6),
                    strs.copy().set_color("#6868B8").scale(1.6),
                    strs.copy().set_color("#4848B8").scale(1.6),
                    strs.copy().set_color("#2828B8").scale(1.6),
                    strs.copy().set_color("#0808B8").scale(1.6),
                )
            if title_2 == "":
                title_2 = (r"{\tiny{\emph{Powered by}:}}\\ ", *PoweredBy)
            title_2 = MobjectOrChars(title_2)
            title_2.set_color(title_2_color).scale(
                title_2_scale).align_on_border(
                    *title_2_position).add_shadow_mobjects(
                        title_2_shadow[0], title_2[title_2_shadow[1]])
            if title_2_extra != "":
                title_2[title_2_extra[0]].set_color(title_2_extra[1]).shift(
                    title_2_extra[2])
            if title_2_indicate_scale_factor == "":
                title_width = mobjs_2.get_width()
                title_2_indicate_scale_factor = (title_width -
                                                 0.5) / title_width
            startscreens.add(
                ShowSubmobjectsOneByOneAndFadeInThenIndicateThenFadeOut(
                    mobjs_2.scale(mobjs_2_scale),
                    title_2,
                    indicate_scale_factor=title_2_indicate_scale_factor,
                    show_rate_func=mobjs_2_rate_func,
                    run_time=mobjs_2_interval * (len(mobjs_2)),
                    **kwargs))
        if title != None or subtitle != None:
            mobjs_3 = [Group(), "", ""]
            if title != None:
                txt_title = TextMobject(title).scale(title_scale)
                if txt_title.get_width() > 14:
                    txt_title.stretch_to_fit_width(14)
                mobjs_3[1] = txt_title.set_color(title_color).to_edge(
                    *title_position)
                mobjs_3[0].add(mobjs_3[1])
            if subtitle != None:
                mobjs_3[0].add(
                    TextMobject(subtitle).set_color(subtitle_color).scale(
                        subtitle_scale).shift(subtitle_position))
            if filename != None and filename != "":
                if reference == None or reference == "":
                    filename_position = reference_position
                mobjs_3[0].add(
                    TextMobject(filename).set_color(filename_color).scale(
                        filename_scale).shift(filename_position))
            if reference != None and reference != "":
                txt_reference = TextMobject(reference).scale(reference_scale)
                if txt_reference.get_width() > 14:
                    txt_reference.stretch_to_fit_width(14)
                mobjs_3[0].add(
                    txt_reference.set_color(reference_color).shift(
                        reference_position))
            if warning != None and warning != "":
                txt_warning = TextMobject(warning).scale(
                    warning_scale)  # height=0.3
                if txt_warning.get_width() > 14:
                    txt_warning.stretch_to_fit_width(14)
                mobjs_3[2] = txt_warning.set_color(warning_color).shift(
                    warning_position)
            animations = AGroup()
            if len(mobjs_3[0]) > 0:
                animations.add(
                    FadeIn(mobjs_3[0],
                           run_time=0.5,
                           scale_factor=1,
                           color=None))
            if len(mobjs_3[1]) > 0:
                animations.add(GrowFromCenter(Underline(mobjs_3[1])))
            if len(mobjs_3[2]) > 0:
                animations.add(
                    FadeInThenIndicate(mobjs_3[2],
                                       run_time=0.5,
                                       scale_factor=1.2,
                                       color=None))
            startscreens.add(
                FadeoutSuccession(AnimationGroup(*animations,
                                                 run_time=mobjes_3_run_time),
                                  run_time=0.05))
        super().__init__(AnimationGroup(*startscreens, lag_ratio=1), **kwargs)
 def __init__(self, str, shift=[0, 3.6, 0], **kwargs):
     GrowFromCenter.__init__(self, TextMobject(
         r"\titleA{"+str+"}").shift(shift))