본문 바로가기

카테고리 없음

[017]set_fill/set_stroke

반응형

set_fill

        rect = Rectangle()
        rect.set_fill(RED_C, opacity=1)


set_stroke (1)

        rect1 = Rectangle(width=2,height=2)
        rect1.set_fill(BLUE, opacity=1)

        rect2 = rect1.copy()
        rect2.next_to(rect1,RIGHT)

        dot1 = Dot(radius=0.3)
        dot2 = dot1.copy()

        dot1.set_stroke(RED_E,2,background=True)
        dot2.set_stroke(RED_E, 2, background=False)

        dot1.move_to(rect1)
        dot2.move_to(rect2)

        self.add(rect1,dot1,rect2,dot2)
        self.wait()


set_stroke (2)

        rect1 = Rectangle(width=2,height=2)
        rect1.set_fill(BLUE, opacity=1)

        rect2 = rect1.copy()
        rect2.next_to(rect1,RIGHT)

        asterisk1 = TextMobject("*")
        asterisk1.set_height(0.7)
        asterisk1.set_stroke(BLACK, 3, background=True)
        asterisk1.move_to(rect1)

        asterisk2 = TextMobject("*")
        asterisk2.set_height(0.7)
        asterisk2.set_stroke(BLACK, 3, background=False)
        asterisk2.move_to(rect2)

        self.add(rect1,asterisk1,rect2,asterisk2)      
        self.wait()

반응형