Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Move example to rate_functions.py

nilaybhatiae8a7593de609
diff --git a/docs/source/_build/html/.doctrees/changelog.doctree b/docs/source/_build/html/.doctrees/changelog.doctree
index abf2a5115..f69366705 100644
Binary files a/docs/source/_build/html/.doctrees/changelog.doctree and b/docs/source/_build/html/.doctrees/changelog.doctree differ
diff --git a/docs/source/examples/rate_functions.rst b/docs/source/examples/rate_functions.rst
deleted file mode 100644
index 3af4066ec..000000000
--- a/docs/source/examples/rate_functions.rst
+++ /dev/null
@@ -1,36 +0,0 @@
-Rate functions
-===============
-
-There are primarily 3 kinds of easing functions
-1. Ease In - The animation has a smooth start
-2. Ease Out - The animation has a smooth end
-3. Ease In Out - The animation has a smooth start as well as smooth end
-
-.. manim:: RateFunctions1Example
-
- class RateFunctions1Example(Scene):
- def construct(self):
- line1 = Line(3*LEFT, 3*RIGHT).shift(UP).set_color(RED)
- line2 = Line(3*LEFT, 3*RIGHT).set_color(GREEN)
- line3 = Line(3*LEFT, 3*RIGHT).shift(DOWN).set_color(BLUE)
-
- dot1 = Dot().move_to(line1.get_left())
- dot2 = Dot().move_to(line2.get_left())
- dot3 = Dot().move_to(line3.get_left())
-
- label1 = Tex("Ease In").next_to(line1, RIGHT)
- label2 = Tex("Ease out").next_to(line2, RIGHT)
- label3 = Tex("Ease In Out").next_to(line3, RIGHT)
-
- self.play(
- FadeIn(VGroup(line1, line2, line3),
- FadeIn(VGroup(dot1, dot2, dot3))),
- Write(VGroup(label1, label2, label3)),
- )
- self.play(
- MoveAlongPath(dot1, line1, rate_func=ease_in_sine),
- MoveAlongPath(dot2, line2, rate_func=ease_out_sine),
- MoveAlongPath(dot3, line3, rate_func=ease_in_out_sine),
- run_time=7
- )
- self.wait()
\ No newline at end of file
diff --git a/manim/utils/rate_functions.py b/manim/utils/rate_functions.py
index 16137ebf8..0118f0726 100644
--- a/manim/utils/rate_functions.py
+++ b/manim/utils/rate_functions.py
@@ -1,5 +1,33 @@
"""A selection of rate functions, i.e., *speed curves* for animations.
-Please find a standard list at https://easings.net/"""
+Please find a standard list at https://easings.net/
+
+class RateFunctions1Example(Scene):
+ def construct(self):
+ line1 = Line(3*LEFT, 3*RIGHT).shift(UP).set_color(RED)
+ line2 = Line(3*LEFT, 3*RIGHT).set_color(GREEN)
+ line3 = Line(3*LEFT, 3*RIGHT).shift(DOWN).set_color(BLUE)
+
+ dot1 = Dot().move_to(line1.get_left())
+ dot2 = Dot().move_to(line2.get_left())
+ dot3 = Dot().move_to(line3.get_left())
+
+ label1 = Tex("Ease In").next_to(line1, RIGHT)
+ label2 = Tex("Ease out").next_to(line2, RIGHT)
+ label3 = Tex("Ease In Out").next_to(line3, RIGHT)
+
+ self.play(
+ FadeIn(VGroup(line1, line2, line3),
+ FadeIn(VGroup(dot1, dot2, dot3))),
+ Write(VGroup(label1, label2, label3)),
+ )
+ self.play(
+ MoveAlongPath(dot1, line1, rate_func=ease_in_sine),
+ MoveAlongPath(dot2, line2, rate_func=ease_out_sine),
+ MoveAlongPath(dot3, line3, rate_func=ease_in_out_sine),
+ run_time=7
+ )
+ self.wait()
+"""
__all__ = [