본문 바로가기

Programming/Manim code

[025]ArcBetweenPoints

반응형
    def arc_between_test1(self):
        values = [PI/8, PI/4, PI/2, PI, 3*PI/2]
        strs = ["PI/8", "PI/4", "PI/2", "PI", "3*PI/2"]

        def get_arc_text(str, angle_value):
            arc = ArcBetweenPoints(LEFT, RIGHT, angle=angle_value)
            num = Text(str, size=0.35, stroke_width=0).next_to(arc,UP)
            return VGroup(arc,num)

        arcs = VGroup(*[get_arc_text(str,angle_value) for str, angle_value in zip(strs,values)])      
        arcs.arrange(RIGHT)

        self.add(arcs)
        self.wait()

 


 

Change Arc size using ValueTracker

 

    def arc_between_test(self):      
        tracker = ValueTracker(1.15)
        arc = ArcBetweenPoints(LEFT+UP*2,RIGHT+UP*2, angle=TAU/1.15)
        arc = always_redraw(lambda : ArcBetweenPoints(LEFT+UP*2,RIGHT+UP*2, angle=TAU/tracker.get_value()))

        self.add(arc)
        self.play(tracker.set_value, 8, rate_func=there_and_back, run_time=4)
        self.wait()

 

 

 

반응형

'Programming > Manim code' 카테고리의 다른 글

[027]Ellipse/Annulus/AnnularSector/Sector  (0) 2020.05.11
[026]Circle  (0) 2020.05.11
[024]Arc  (0) 2020.05.11
[023]Rectangle, Square, RoundedRectangle  (0) 2020.05.11
[022]Triangle/ArrowTip  (0) 2020.05.06