b1ch0u
b1ch0u

Reputation: 1336

How to have multiple dots move at constant speed around a circle in manim?

I want to reproduce the animation here in manim.

I found how to have multiple dots move along a circle, but they only do one turn and don't have constant speed.

How to have them move at constant speed and do multiple turns ?

Here is my attempt up to now :

def construct(self):
    circle = Circle()
    points = Group(*[Dot((1, 0, 0)) for _ in range(2)])
    self.add(circle)
    self.add(points)
    self.play(
              MoveAlongPath(points[0], circle, run_time=1),
              MoveAlongPath(points[1], circle, run_time=2)
              )

Upvotes: 2

Views: 1722

Answers (1)

b1ch0u
b1ch0u

Reputation: 1336

Just found an answer, easier than I thought :

self.play(Rotating(points[0],
                   radians=2 * TAU,
                   about_point=ORIGIN),
          Rotating(points[1],
                   radians=TAU,
                   about_point=ORIGIN),
          )

Upvotes: 1

Related Questions