Skip to content

Instantly share code, notes, and snippets.

@thomasnield
Last active August 26, 2023 00:49
Show Gist options
  • Save thomasnield/423040a82da114184c39eba75f2a4f70 to your computer and use it in GitHub Desktop.
Save thomasnield/423040a82da114184c39eba75f2a4f70 to your computer and use it in GitHub Desktop.
Manim - Circle Trace
from manim import *
import os
class CircleTraceTest(Scene):
def construct(self):
circle = Circle(radius=2)
self.add(circle)
vt = ValueTracker(0.0)
point: Dot = always_redraw(lambda: Dot(point=circle.point_from_proportion(vt.get_value())))
tex = always_redraw(lambda:
DecimalNumber(vt.get_value(), num_decimal_places=1) \
.move_to(
circle.point_from_proportion(vt.get_value())*1.3
)
)
self.add(vt,tex,point)
self.wait()
self.play(vt.animate.set_value(1), run_time=3)
self.wait()
self.play(vt.animate.set_value(0), run_time=3)
self.wait()
if __name__ == "__main__":
os.system(r"manim -qh -v WARNING --disable_caching -o CircleTraceTest manim_circle_trace.py CircleTraceTest")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment