from manim import *
class GrowEdgeDemo(Scene):
    def construct(self):
        title = Text("GrowFromEdge：从指定边缘开始生长", font="STLiti", font_size=32).to_edge(UP)
        self.play(FadeIn(title), run_time=0.6)
        r1 = Rectangle(width=1.8, height=1.1, color=BLUE, stroke_width=7).shift(UP * 1.6 + LEFT * 2.6)
        r2 = Rectangle(width=1.8, height=1.1, color=RED, stroke_width=7)
        r3 = Rectangle(width=1.8, height=1.1, color=YELLOW, stroke_width=7).shift(DOWN * 1.6 + RIGHT * 2.6)
        self.play(GrowFromEdge(r1, DOWN, point_color=BLUE), run_time=1.0)
        self.play(GrowFromEdge(r2, RIGHT, point_color=RED), run_time=1.0)
        self.play(GrowFromEdge(r3, UP, point_color=YELLOW), run_time=1.0)
        note = Text("edge 用 DOWN / RIGHT / UP 等方向常量指定起始边", font="STLiti", font_size=21, color=YELLOW).to_edge(DOWN)
        self.play(FadeIn(note), run_time=0.5)
        self.wait(2.2)
