Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12261

Is there something wrong with the LaggedStart class in manim?

$
0
0

I am new to manim and am employing the use of updater functions to change the size of a specific animation. (It is from the first Brian Amedee tutorial) It works when I separate the objects to be animated but when I use the LaggedStart class, it doesn't enlarge at all.

This is the code I have:

from manim import *class CircleGettingBigger(Scene):    def construct(self):        r = ValueTracker(0.5)        circle = always_redraw(lambda :                         Circle(radius = r.get_value(), stroke_color = YELLOW,                        stroke_width = 5)                )        line_radius = always_redraw(lambda:                      Line(start = circle.get_center(), end = circle.get_bottom(), stroke_color = RED_B, stroke_width = 10)        )        triangle = always_redraw(lambda :                    Polygon(circle.get_top(), circle.get_left(), circle.get_right(), stroke_color = GREEN_C)        )        self.play(LaggedStart(            Create(circle), DrawBorderThenFill(line_radius), DrawBorderThenFill(triangle),            run_time = 4, lag_ratio = 0.05        ))        self.play(r.animate.set_value(2), run_time = 5)

Here is the video link:https://imgur.com/a/HU8Q71jIf you are unable to see the video at this time, the video plays the three objects but does not enlarge them.

However, if I do not use LaggedStart as in this code:

class CircleGettingBigger(Scene):    def construct(self):        r = ValueTracker(0.5)        circle = always_redraw(lambda :                         Circle(radius = r.get_value(), stroke_color = YELLOW,                        stroke_width = 5)                )        line_radius = always_redraw(lambda:                      Line(start = circle.get_center(), end = circle.get_bottom(), stroke_color = RED_B, stroke_width = 10)        )        triangle = always_redraw(lambda :                    Polygon(circle.get_top(), circle.get_left(), circle.get_right(), stroke_color = GREEN_C)        )        self.play(Create(circle), run_time = 1)        self.play(DrawBorderThenFill(line_radius), run_time = 1)        self.play(DrawBorderThenFill(triangle), run_time = 1)        self.play(r.animate.set_value(2), run_time = 5)

Using the code above, it enlarges as planned.https://imgur.com/a/RNjJbuDWhat can I do to fix that?


Viewing all articles
Browse latest Browse all 12261

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>