A community-maintained Python framework for creating mathematical animations.
Add animation documentation and asset folder
Kolloome1fb9f480b9e
diff --git a/docs/source/animation.rst b/docs/source/animation.rstnew file mode 100644index 000000000..3fe878d57--- /dev/null+++ b/docs/source/animation.rst@@ -0,0 +1,160 @@+Animation+=========++++The simplest of which is ``Scene.add``. The object appears on the first frame+without any animation::++ class NoAnimation(Scene):+ def construct(self):+ square = Square()+ self.add(square))++Animation are used in conjunction with ``scene.Play``++Fade+----++FadeIn :download:`/assets/AnimationFadeIn.mp4`::++ class AnimationFadeIn(Scene):+ def construct(self):+ square = Square()++ anno = TextMobject("Fade In")+ anno.shift(2 * DOWN)+ self.add(anno)+ self.play(FadeIn(square))++++FadeOut :download:`/assets/AnimationFadeOut.mp4`::++ class AnimationFadeOut(Scene):+ def construct(self):+ square = Square()++ anno = TextMobject("Fade Out")+ anno.shift(2 * DOWN)+ self.add(anno)+ self.add(square)+ self.play(FadeOut(square))++++FadeInFrom :download:`/assets/AnimationFadeInFrom.mp4`::++ class AnimationFadeInFrom(Scene):+ def construct(self):+ square = Square()+ for label, edge in zip(+ ["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]+ ):+ anno = TextMobject(f"Fade In from {label}")+ anno.shift(2 * DOWN)+ self.add(anno)++ self.play(FadeInFrom(square, edge))+ self.remove(anno, square)++++FadeOutAndShift :download:`assets/AnimationFadeOutAndShift.mp4`::++ class AnimationFadeOutAndShift(Scene):+ def construct(self):+ square = Square()+ for label, edge in zip(+ ["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]+ ):+ anno = TextMobject(f"Fade Out and shift {label}")+ anno.shift(2 * DOWN)+ self.add(anno)++ self.play(FadeOutAndShift(square, edge))+ self.remove(anno, square)++++FadeInFromLarge :download:`assets/AnimationFadeInFromLarge.mp4`::++ class AnimationFadeInFromLarge(Scene):+ def construct(self):+ square = Square()++ for factor in [0.1, 0.5, 0.8, 1, 2, 5]:+ anno = TextMobject(f"Fade In from large scale\_factor={factor}")+ anno.shift(2 * DOWN)+ self.add(anno)++ self.play(FadeInFromLarge(square, scale_factor=factor))+ self.remove(anno, square)++++FadeInFromPoint :download:`assets/AnimationFadeInFromPoint.mp4`::++ class AnimationFadeInFromPoint(Scene):+ def construct(self):+ square = Square()+ for i in range(-6, 7, 2):+ anno = TextMobject(f"Fade In from point {i}")+ anno.shift(2 * DOWN)+ self.add(anno)+ self.play(FadeInFromPoint(square, point=i))+ self.remove(anno, square)++++Grow+----++GrowFromEdge :download:`assets/AnimationGrowFromEdge.mp4`::++ class AnimationGrowFromEdge(Scene):+ def construct(self):++ for label, edge in zip(+ ["LEFT", "RIGHT", "UP", "DOWN"], [LEFT, RIGHT, UP, DOWN]+ ):+ anno = TextMobject(f"Grow from {label} edge")+ anno.shift(2 * DOWN)+ self.add(anno)+ square = Square()+ self.play(GrowFromEdge(square, edge))+ self.remove(anno, square)++++GrowFromCenter :download:`assets/AnimationGrowFromCenter.mp4`::++ class AnimationGrowFromCenter(Scene):+ def construct(self):+ square = Square()++ anno = TextMobject("Grow from center")+ anno.shift(2 * DOWN)+ self.add(anno)++ self.play(GrowFromCenter(square))+++++Diagonal Directions+-------------------++You can combine cardinal directions to form diagonal animations :download:`assets/AnimationFadeInFromDiagnal.mp4`::++ class AnimationFadeInFromDiagnal(Scene):+ def construct(self):+ square = Square()+ for diag in [UP + LEFT, UP + RIGHT, DOWN + LEFT, DOWN + RIGHT]:+ self.play(FadeInFrom(square, diag))++++.. note::+ You can also use the abbreviated forms like ``UL, UR, DL, DR``.+ See :ref:`ref-directions`.diff --git a/docs/source/assets/AnimationFadeIn.mp4 b/docs/source/assets/AnimationFadeIn.mp4new file mode 100644index 000000000..783a6fa89Binary files /dev/null and b/docs/source/assets/AnimationFadeIn.mp4 differdiff --git a/docs/source/assets/AnimationFadeInFrom.mp4 b/docs/source/assets/AnimationFadeInFrom.mp4new file mode 100644index 000000000..90ead0726Binary files /dev/null and b/docs/source/assets/AnimationFadeInFrom.mp4 differdiff --git a/docs/source/assets/AnimationFadeInFromDiagnal.mp4 b/docs/source/assets/AnimationFadeInFromDiagnal.mp4new file mode 100644index 000000000..25b0145c4Binary files /dev/null and b/docs/source/assets/AnimationFadeInFromDiagnal.mp4 differdiff --git a/docs/source/assets/AnimationFadeInFromLarge.mp4 b/docs/source/assets/AnimationFadeInFromLarge.mp4new file mode 100644index 000000000..589789ea4Binary files /dev/null and b/docs/source/assets/AnimationFadeInFromLarge.mp4 differdiff --git a/docs/source/assets/AnimationFadeInFromPoint.mp4 b/docs/source/assets/AnimationFadeInFromPoint.mp4new file mode 100644index 000000000..cdfdc84ccBinary files /dev/null and b/docs/source/assets/AnimationFadeInFromPoint.mp4 differdiff --git a/docs/source/assets/AnimationFadeInFromSmall.mp4 b/docs/source/assets/AnimationFadeInFromSmall.mp4new file mode 100644index 000000000..9e8f80974Binary files /dev/null and b/docs/source/assets/AnimationFadeInFromSmall.mp4 differdiff --git a/docs/source/assets/AnimationFadeOut.mp4 b/docs/source/assets/AnimationFadeOut.mp4new file mode 100644index 000000000..5938ab7e7Binary files /dev/null and b/docs/source/assets/AnimationFadeOut.mp4 differdiff --git a/docs/source/assets/AnimationFadeOutAndShift.mp4 b/docs/source/assets/AnimationFadeOutAndShift.mp4new file mode 100644index 000000000..834145cb4Binary files /dev/null and b/docs/source/assets/AnimationFadeOutAndShift.mp4 differdiff --git a/docs/source/assets/AnimationGrowFromCenter.mp4 b/docs/source/assets/AnimationGrowFromCenter.mp4new file mode 100644index 000000000..634863bb7Binary files /dev/null and b/docs/source/assets/AnimationGrowFromCenter.mp4 differdiff --git a/docs/source/assets/AnimationGrowFromEdge.mp4 b/docs/source/assets/AnimationGrowFromEdge.mp4new file mode 100644index 000000000..7da5f313dBinary files /dev/null and b/docs/source/assets/AnimationGrowFromEdge.mp4 differdiff --git a/docs/source/constants.rst b/docs/source/constants.rstindex a971d93a9..c1e24f66a 100644--- a/docs/source/constants.rst+++ b/docs/source/constants.rst@@ -75,6 +75,8 @@ Render setting presetsLOW_QUALITY_CAMERA_CONFIG854x480 @ 15fps. # Used when ``-l`` flag is passed+.. _ref-directions:+Coordinates-----------diff --git a/docs/source/index.rst b/docs/source/index.rstindex 199b895cc..145713254 100644--- a/docs/source/index.rst+++ b/docs/source/index.rst@@ -17,8 +17,9 @@ a pull request there.aboutinstallation/indexgetting_started/index+ animationconstants-+Indices and tables==================