Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add example for using rate function

nilaybhatiad7f405c48a2e
diff --git a/docs/source/_build/html/.doctrees/changelog.doctree b/docs/source/_build/html/.doctrees/changelog.doctree
new file mode 100644
index 000000000..63a64fa67
Binary files /dev/null and b/docs/source/_build/html/.doctrees/changelog.doctree differ
diff --git a/docs/source/_build/html/.doctrees/contributing.doctree b/docs/source/_build/html/.doctrees/contributing.doctree
new file mode 100644
index 000000000..f618d998d
Binary files /dev/null and b/docs/source/_build/html/.doctrees/contributing.doctree differ
diff --git a/docs/source/_build/html/.doctrees/examples.doctree b/docs/source/_build/html/.doctrees/examples.doctree
new file mode 100644
index 000000000..621c54a0c
Binary files /dev/null and b/docs/source/_build/html/.doctrees/examples.doctree differ
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index 940c8efa8..a71ec2a31 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -62,6 +62,7 @@ Mobjects, Scenes, and Animations
#. Add a :code:`Variable` class for displaying text that continuously updates to reflect the value of a python variable.
#. The ``Tex`` and ``MathTex`` objects allow you to specify a custom TexTemplate using the ``template`` keyword argument.
#. :code:`VGroup` now supports printing the class names of contained mobjects and :code:`VDict` supports printing the internal dict of mobjects
+#. Add all the standard easing functions
Documentation
diff --git a/docs/source/examples/rate_functions.rst b/docs/source/examples/rate_functions.rst
new file mode 100644
index 000000000..3af4066ec
--- /dev/null
+++ b/docs/source/examples/rate_functions.rst
@@ -0,0 +1,36 @@
+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