Created
July 16, 2024 15:14
-
-
Save EteimZ/d840e4b361ad65f1fc1de43b298a27ee to your computer and use it in GitHub Desktop.
Unit circle animation in manim.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from manim import * | |
class UnitCircle(MovingCameraScene): | |
def construct(self): | |
title = Title("The Unit Circle", include_underline=False) | |
circle = Circle() | |
numberplane = NumberPlane() | |
line = Line(ORIGIN, np.array([1.0, 0, 0])) | |
dot = Dot().move_to(np.array([1.0, 0, 0])) | |
label_1 = Text('(1, 0)').scale(0.5).next_to(circle, RIGHT) | |
label_2 = Text('(0, 1)').scale(0.5).next_to(circle, UP) | |
label_3 = Text('(-1, 0)').scale(0.5).next_to(circle, LEFT) | |
label_4 = Text('(0, -1)').scale(0.5).next_to(circle, DOWN) | |
labels = VGroup(label_1, label_2, label_3, label_4) | |
line_dot = VGroup(line, dot) | |
self.add(numberplane) | |
self.play(Create(title)) | |
self.play(Create(circle)) | |
self.play(Write(labels)) | |
self.play(Create(line_dot)) | |
self.play(self.camera.frame.animate.scale(0.5)) | |
self.play(Rotate(line_dot, angle=2*PI, about_point=ORIGIN, run_time=1.5, rate_func=linear)) | |
self.wait() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is very much like Canvas just more precise