Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Get rid of ContinualRotation

Grant Sanderson04b4c1dad8f1
diff --git a/manimlib/continual_animation/continual_animation.py b/manimlib/continual_animation/continual_animation.py
index 9717c0a76..5552047fd 100644
--- a/manimlib/continual_animation/continual_animation.py
+++ b/manimlib/continual_animation/continual_animation.py
@@ -70,27 +70,6 @@ class ContinualAnimationGroup(ContinualAnimation):
continual_animation.update(dt)
-class ContinualRotation(ContinualAnimation):
- CONFIG = {
- "axis": OUT,
- "rate": np.pi / 12, # Radians per second
- "in_place": True,
- "about_point": None,
- }
-
- def update_mobject(self, dt):
- if self.about_point:
- about_point = self.about_point
- elif self.in_place:
- about_point = self.mobject.get_center()
- else:
- about_point = ORIGIN
- self.mobject.rotate(
- dt * self.rate, axis=self.axis,
- about_point=about_point
- )
-
-
class ContinualMovement(ContinualAnimation):
CONFIG = {
"direction": RIGHT,
diff --git a/old_projects/WindingNumber_G.py b/old_projects/WindingNumber_G.py
index 07d13b4d5..522843879 100644
--- a/old_projects/WindingNumber_G.py
+++ b/old_projects/WindingNumber_G.py
@@ -1144,7 +1144,7 @@ class TwoDScreenInOurThreeDWorld(AltTeacherStudentsScene, ThreeDScene):
run_time = 4,
added_anims = [MoveToTarget(everything, run_time = 4)],
)
- self.add(ContinualRotation(everything, axis = UP, rate = 3*DEGREES))
+ always_rotate(everything, axis=UP, rate=3 * DEGREES)
self.wait(10)
class EveryOutputPointHasAColor(ColorMappedObjectsScene):
diff --git a/old_projects/div_curl.py b/old_projects/div_curl.py
index 71ab0ecc9..0bdb62fdb 100644
--- a/old_projects/div_curl.py
+++ b/old_projects/div_curl.py
@@ -2406,11 +2406,9 @@ class IntroduceCurl(IntroduceVectorField):
label.add_background_rectangle()
label.next_to(arrows, DOWN)
self.add_foreground_mobjects(label)
- self.add(ContinualRotation(
- arrows, rate=u * 30 * DEGREES
- ))
+ always_rotate(arrows, rate=u * 30 * DEGREES)
self.play(
- VFadeIn(arrows),
+ FadeIn(arrows),
FadeIn(label)
)
self.wait(2)
@@ -2488,9 +2486,8 @@ class ShearCurl(IntroduceCurl):
)
twig.add(Dot(twig.get_center()))
twig.move_to(circle)
- twig_rotation = ContinualRotation(
+ always_rotate(
twig, rate=-90 * DEGREES,
- start_up_time=8,
)
self.play(FadeInFrom(twig, UP))
diff --git a/old_projects/mug.py b/old_projects/mug.py
index e2eceda61..1120064c8 100644
--- a/old_projects/mug.py
+++ b/old_projects/mug.py
@@ -288,7 +288,7 @@ class AboutToyPuzzles(UtilitiesPuzzleScene, TeacherStudentsScene, ThreeDScene):
eulers.get_bottom(),
color = WHITE
)
- self.add(ContinualRotation(cube, axis = UP))
+ always_rotate(cube, axis=UP)
self.play(
GrowArrow(arrow_to_eulers),
Write(eulers),
@@ -1879,7 +1879,8 @@ class EulersFormulaForGeneralPlanarGraph(LightUpNodes, ThreeDScene):
self.play(FadeOut(self.vertices))
self.play(ReplacementTransform(regions, cube, run_time = 2))
cube.sort(lambda p : -p[2])
- self.add(ContinualRotation(cube, axis = UP, in_place = False))
+ always_rotate(cube, axis=UP, about_point=ORIGIN)
+ self.add(cube)
self.wait(3)
self.play(
FadeOut(self.top_formula),