mirror of
https://github.com/3b1b/manim.git
synced 2025-08-20 05:14:12 +00:00
Get rid of ContinualRotation
This commit is contained in:
parent
a73cbb8014
commit
04b4c1dad8
4 changed files with 7 additions and 30 deletions
|
@ -70,27 +70,6 @@ class ContinualAnimationGroup(ContinualAnimation):
|
||||||
continual_animation.update(dt)
|
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):
|
class ContinualMovement(ContinualAnimation):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"direction": RIGHT,
|
"direction": RIGHT,
|
||||||
|
|
|
@ -1144,7 +1144,7 @@ class TwoDScreenInOurThreeDWorld(AltTeacherStudentsScene, ThreeDScene):
|
||||||
run_time = 4,
|
run_time = 4,
|
||||||
added_anims = [MoveToTarget(everything, 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)
|
self.wait(10)
|
||||||
|
|
||||||
class EveryOutputPointHasAColor(ColorMappedObjectsScene):
|
class EveryOutputPointHasAColor(ColorMappedObjectsScene):
|
||||||
|
|
|
@ -2406,11 +2406,9 @@ class IntroduceCurl(IntroduceVectorField):
|
||||||
label.add_background_rectangle()
|
label.add_background_rectangle()
|
||||||
label.next_to(arrows, DOWN)
|
label.next_to(arrows, DOWN)
|
||||||
self.add_foreground_mobjects(label)
|
self.add_foreground_mobjects(label)
|
||||||
self.add(ContinualRotation(
|
always_rotate(arrows, rate=u * 30 * DEGREES)
|
||||||
arrows, rate=u * 30 * DEGREES
|
|
||||||
))
|
|
||||||
self.play(
|
self.play(
|
||||||
VFadeIn(arrows),
|
FadeIn(arrows),
|
||||||
FadeIn(label)
|
FadeIn(label)
|
||||||
)
|
)
|
||||||
self.wait(2)
|
self.wait(2)
|
||||||
|
@ -2488,9 +2486,8 @@ class ShearCurl(IntroduceCurl):
|
||||||
)
|
)
|
||||||
twig.add(Dot(twig.get_center()))
|
twig.add(Dot(twig.get_center()))
|
||||||
twig.move_to(circle)
|
twig.move_to(circle)
|
||||||
twig_rotation = ContinualRotation(
|
always_rotate(
|
||||||
twig, rate=-90 * DEGREES,
|
twig, rate=-90 * DEGREES,
|
||||||
start_up_time=8,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
self.play(FadeInFrom(twig, UP))
|
self.play(FadeInFrom(twig, UP))
|
||||||
|
|
|
@ -288,7 +288,7 @@ class AboutToyPuzzles(UtilitiesPuzzleScene, TeacherStudentsScene, ThreeDScene):
|
||||||
eulers.get_bottom(),
|
eulers.get_bottom(),
|
||||||
color = WHITE
|
color = WHITE
|
||||||
)
|
)
|
||||||
self.add(ContinualRotation(cube, axis = UP))
|
always_rotate(cube, axis=UP)
|
||||||
self.play(
|
self.play(
|
||||||
GrowArrow(arrow_to_eulers),
|
GrowArrow(arrow_to_eulers),
|
||||||
Write(eulers),
|
Write(eulers),
|
||||||
|
@ -1879,7 +1879,8 @@ class EulersFormulaForGeneralPlanarGraph(LightUpNodes, ThreeDScene):
|
||||||
self.play(FadeOut(self.vertices))
|
self.play(FadeOut(self.vertices))
|
||||||
self.play(ReplacementTransform(regions, cube, run_time = 2))
|
self.play(ReplacementTransform(regions, cube, run_time = 2))
|
||||||
cube.sort(lambda p : -p[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.wait(3)
|
||||||
self.play(
|
self.play(
|
||||||
FadeOut(self.top_formula),
|
FadeOut(self.top_formula),
|
||||||
|
|
Loading…
Add table
Reference in a new issue