From 04b4c1dad8f10e9e98b53f7e3b9d9e8429ac059e Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 11 Feb 2019 13:22:22 -0800 Subject: [PATCH] Get rid of ContinualRotation --- .../continual_animation.py | 21 ------------------- old_projects/WindingNumber_G.py | 2 +- old_projects/div_curl.py | 9 +++----- old_projects/mug.py | 5 +++-- 4 files changed, 7 insertions(+), 30 deletions(-) diff --git a/manimlib/continual_animation/continual_animation.py b/manimlib/continual_animation/continual_animation.py index 9717c0a7..5552047f 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 07d13b4d..52284387 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 71ab0ecc..0bdb62fd 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 e2eceda6..1120064c 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),