Skip to content

Animating a List of Arbitrary Length of Objects #2909

Discussion options

You must be logged in to vote

You can use the Python * aka unpack operator for self.play (I see you already use it in Group). There is an additional example in the TransformPathArc docs.

class Lonely_Runner_Conjecture(Scene):
    def construct(self):
        circle = Circle()
        points = Group(*[Dot((1, 0, 0)) for _ in range(5)])
        self.add(circle)
        self.add(points)
        anims = []
        for i in np.arange(5):
            anims.append(Rotating(points[i], radians=(i + 1) * TAU, about_point=ORIGIN))
        self.play(*anims)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SuperUser-Vermeylen
Comment options

Answer selected by SuperUser-Vermeylen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants