Skip to content

Commit 8cc5195

Browse files
committed
Replace DEGREES -> DEG
1 parent d8e06c6 commit 8cc5195

File tree

13 files changed

+38
-37
lines changed

13 files changed

+38
-37
lines changed

docs/source/documentation/constants.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Mathematical constant
7474
7575
PI = np.pi
7676
TAU = 2 * PI
77-
DEGREES = TAU / 360
77+
DEG = TAU / 360
7878
7979
Text
8080
----

docs/source/getting_started/example_scenes.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ InteractiveDevlopment
3434
self.play(ReplacementTransform(square, circle))
3535
self.wait()
3636
self.play(circle.animate.stretch(4, 0))
37-
self.play(Rotate(circle, 90 * DEGREES))
37+
self.play(Rotate(circle, 90 * DEG))
3838
self.play(circle.animate.shift(2 * RIGHT).scale(0.25))
3939

4040
text = Text("""
@@ -221,7 +221,7 @@ TexTransformExample
221221
self.play(
222222
TransformMatchingTex(
223223
lines[0].copy(), lines[1],
224-
path_arc=90 * DEGREES,
224+
path_arc=90 * DEG,
225225
),
226226
**play_kw
227227
)
@@ -599,8 +599,8 @@ SurfaceExample
599599
# Set perspective
600600
frame = self.camera.frame
601601
frame.set_euler_angles(
602-
theta=-30 * DEGREES,
603-
phi=70 * DEGREES,
602+
theta=-30 * DEG,
603+
phi=70 * DEG,
604604
)
605605

606606
surface = surfaces[0]
@@ -624,8 +624,8 @@ SurfaceExample
624624
self.play(
625625
Transform(surface, surfaces[2]),
626626
# Move camera frame during the transition
627-
frame.animate.increment_phi(-10 * DEGREES),
628-
frame.animate.increment_theta(-20 * DEGREES),
627+
frame.animate.increment_phi(-10 * DEG),
628+
frame.animate.increment_theta(-20 * DEG),
629629
run_time=3
630630
)
631631
# Add ambient rotation

example_scenes.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def construct(self):
190190
# to go to a non-equal substring from the target,
191191
# use the key map.
192192
key_map={"+": "-"},
193-
path_arc=90 * DEGREES,
193+
path_arc=90 * DEG,
194194
),
195195
)
196196
self.wait()
@@ -203,7 +203,7 @@ def construct(self):
203203
TransformMatchingStrings(
204204
lines[2].copy(), lines[3],
205205
key_map={"2": R"\sqrt"},
206-
path_arc=-30 * DEGREES,
206+
path_arc=-30 * DEG,
207207
),
208208
)
209209
self.wait(2)
@@ -616,8 +616,8 @@ def construct(self):
616616
self.play(
617617
Transform(surface, surfaces[2]),
618618
# Move camera frame during the transition
619-
self.frame.animate.increment_phi(-10 * DEGREES),
620-
self.frame.animate.increment_theta(-20 * DEGREES),
619+
self.frame.animate.increment_phi(-10 * DEG),
620+
self.frame.animate.increment_theta(-20 * DEG),
621621
run_time=3
622622
)
623623
# Add ambient rotation
@@ -666,7 +666,7 @@ def construct(self):
666666
self.play(ReplacementTransform(square, circle))
667667
self.wait()
668668
self.play(circle.animate.stretch(4, 0))
669-
self.play(Rotate(circle, 90 * DEGREES))
669+
self.play(Rotate(circle, 90 * DEG))
670670
self.play(circle.animate.shift(2 * RIGHT).scale(0.25))
671671

672672
text = Text("""

manimlib/animation/indication.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS
1515
from manimlib.constants import ORIGIN, RIGHT, UP
1616
from manimlib.constants import SMALL_BUFF
17-
from manimlib.constants import DEGREES
17+
from manimlib.constants import DEG
1818
from manimlib.constants import TAU
1919
from manimlib.constants import GREY, YELLOW
2020
from manimlib.mobject.geometry import Circle
@@ -395,7 +395,7 @@ def interpolate_submobject(
395395

396396

397397
class TurnInsideOut(Transform):
398-
def __init__(self, mobject: Mobject, path_arc: float = 90 * DEGREES, **kwargs):
398+
def __init__(self, mobject: Mobject, path_arc: float = 90 * DEG, **kwargs):
399399
super().__init__(mobject, path_arc=path_arc, **kwargs)
400400

401401
def create_target(self) -> Mobject:

manimlib/animation/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66

77
from manimlib.animation.animation import Animation
8-
from manimlib.constants import DEGREES
8+
from manimlib.constants import DEG
99
from manimlib.constants import OUT
1010
from manimlib.mobject.mobject import Group
1111
from manimlib.mobject.mobject import Mobject
@@ -314,7 +314,7 @@ def init_path_func(self) -> None:
314314

315315

316316
class CyclicReplace(Transform):
317-
def __init__(self, *mobjects: Mobject, path_arc=90 * DEGREES, **kwargs):
317+
def __init__(self, *mobjects: Mobject, path_arc=90 * DEG, **kwargs):
318318
super().__init__(Group(*mobjects), path_arc=path_arc, **kwargs)
319319

320320
def create_target(self) -> Mobject:

manimlib/camera/camera_frame.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import numpy as np
77
from scipy.spatial.transform import Rotation
88

9-
from manimlib.constants import DEGREES, RADIANS
9+
from manimlib.constants import DEG, RADIANS
1010
from manimlib.constants import FRAME_SHAPE
1111
from manimlib.constants import DOWN, LEFT, ORIGIN, OUT, RIGHT, UP
1212
from manimlib.constants import PI
@@ -26,7 +26,7 @@ def __init__(
2626
frame_shape: tuple[float, float] = FRAME_SHAPE,
2727
center_point: Vect3 = ORIGIN,
2828
# Field of view in the y direction
29-
fovy: float = 45 * DEGREES,
29+
fovy: float = 45 * DEG,
3030
euler_axes: str = "zxz",
3131
# This keeps it ordered first in a scene
3232
z_index=-1,
@@ -181,7 +181,7 @@ def reorient(
181181
Shortcut for set_euler_angles, defaulting to taking
182182
in angles in degrees
183183
"""
184-
self.set_euler_angles(theta_degrees, phi_degrees, gamma_degrees, units=DEGREES)
184+
self.set_euler_angles(theta_degrees, phi_degrees, gamma_degrees, units=DEG)
185185
if center is not None:
186186
self.move_to(np.array(center))
187187
if height is not None:
@@ -209,7 +209,7 @@ def increment_gamma(self, dgamma: float, units=RADIANS):
209209
self.increment_euler_angles(dgamma=dgamma, units=units)
210210
return self
211211

212-
def add_ambient_rotation(self, angular_speed=1 * DEGREES):
212+
def add_ambient_rotation(self, angular_speed=1 * DEG):
213213
self.add_updater(lambda m, dt: m.increment_theta(angular_speed * dt))
214214
return self
215215

manimlib/constants.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161
# Angles
6262
PI: float = np.pi
6363
TAU: float = 2 * PI
64-
DEGREES: float = TAU / 360
64+
DEG: float = TAU / 360
65+
DEGREES = DEG # Many older animations use teh full name
6566
# Nice to have a constant for readability
66-
# when juxtaposed with expressions like 30 * DEGREES
67+
# when juxtaposed with expressions like 30 * DEG
6768
RADIANS: float = 1
6869

6970
# Related to Text

manimlib/mobject/coordinate_systems.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import itertools as it
88

99
from manimlib.constants import BLACK, BLUE, BLUE_D, BLUE_E, GREEN, GREY_A, WHITE, RED
10-
from manimlib.constants import DEGREES, PI
10+
from manimlib.constants import DEG, PI
1111
from manimlib.constants import DL, UL, DOWN, DR, LEFT, ORIGIN, OUT, RIGHT, UP
1212
from manimlib.constants import FRAME_X_RADIUS, FRAME_Y_RADIUS
1313
from manimlib.constants import MED_SMALL_BUFF, SMALL_BUFF
@@ -307,7 +307,7 @@ def get_graph_label(
307307

308308
point = self.input_to_graph_point(x, graph)
309309
angle = self.angle_of_tangent(x, graph)
310-
normal = rotate_vector(RIGHT, angle + 90 * DEGREES)
310+
normal = rotate_vector(RIGHT, angle + 90 * DEG)
311311
if normal[1] < 0:
312312
normal *= -1
313313
label.next_to(point, normal, buff=buff)
@@ -474,7 +474,7 @@ def __init__(
474474
),
475475
length=height,
476476
)
477-
self.y_axis.rotate(90 * DEGREES, about_point=ORIGIN)
477+
self.y_axis.rotate(90 * DEG, about_point=ORIGIN)
478478
# Add as a separate group in case various other
479479
# mobjects are added to self, as for example in
480480
# NumberPlane below

manimlib/mobject/geometry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from manimlib.constants import DL, DOWN, DR, LEFT, ORIGIN, OUT, RIGHT, UL, UP, UR
88
from manimlib.constants import GREY_A, RED, WHITE, BLACK
99
from manimlib.constants import MED_SMALL_BUFF, SMALL_BUFF
10-
from manimlib.constants import DEGREES, PI, TAU
10+
from manimlib.constants import DEG, PI, TAU
1111
from manimlib.mobject.mobject import Mobject
1212
from manimlib.mobject.types.vectorized_mobject import DashedVMobject
1313
from manimlib.mobject.types.vectorized_mobject import VGroup
@@ -983,7 +983,7 @@ def __init__(
983983
):
984984
# Defaults to 0 for odd, 90 for even
985985
if start_angle is None:
986-
start_angle = (n % 2) * 90 * DEGREES
986+
start_angle = (n % 2) * 90 * DEG
987987
start_vect = rotate_vector(radius * RIGHT, start_angle)
988988
vertices = compass_directions(n, start_vect)
989989
super().__init__(*vertices, **kwargs)

manimlib/mobject/matrix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
from manimlib.constants import DOWN, LEFT, RIGHT, ORIGIN
6-
from manimlib.constants import DEGREES
6+
from manimlib.constants import DEG
77
from manimlib.mobject.numbers import DecimalNumber
88
from manimlib.mobject.svg.tex_mobject import Tex
99
from manimlib.mobject.types.vectorized_mobject import VGroup
@@ -196,7 +196,7 @@ def swap_entries_for_ellipses(
196196
dots.set_width(hdots_width)
197197
self.swap_entry_for_dots(row[col_index], dots)
198198
if use_vdots and use_hdots:
199-
rows[row_index][col_index].rotate(-45 * DEGREES)
199+
rows[row_index][col_index].rotate(-45 * DEG)
200200
return self
201201

202202
def get_mob_matrix(self) -> VMobjectMatrixType:

0 commit comments

Comments
 (0)