A community-maintained Python framework for creating mathematical animations.
Moving the ImageFromArray redundant example to reference and renaming examples.
MysaaJavab05400588c4f
diff --git a/docs/source/examples/3d.rst b/docs/source/examples/3d.rstindex de902adc8..268c1a17a 100644--- a/docs/source/examples/3d.rst+++ b/docs/source/examples/3d.rst@@ -1,10 +1,10 @@3D Scenes=================================-.. manim:: ThreeDSphereExample+.. manim:: ThreeDSphere:save_last_frame:- class ThreeDSphereExample(ThreeDScene):+ class ThreeDSphere(ThreeDScene):def construct(self):axes = ThreeDAxes()sphere = ParametricSurface(@@ -18,10 +18,10 @@self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)self.add(axes, sphere)-.. manim:: ThreeDLightSourcePositionExample+.. manim:: ThreeDLightSourcePosition:save_last_frame:- class ThreeDLightSourcePositionExample(ThreeDScene):+ class ThreeDLightSourcePosition(ThreeDScene):def construct(self):axes = ThreeDAxes()sphere = ParametricSurface(@@ -36,9 +36,9 @@self.set_camera_orientation(phi=75 * DEGREES, theta=30 * DEGREES)self.add(axes, sphere)-.. manim:: ThreeDCameraRotationExample+.. manim:: ThreeDCameraRotation- class ThreeDCameraRotationExample(ThreeDScene):+ class ThreeDCameraRotation(ThreeDScene):def construct(self):axes = ThreeDAxes()circle=Circle()@@ -50,9 +50,9 @@self.move_camera(phi=75 * DEGREES, theta=30 * DEGREES)self.wait()-.. manim:: ThreeDCameraIllusionRotationExample+.. manim:: ThreeDCameraIllusionRotation- class ThreeDCameraIllusionRotationExample(ThreeDScene):+ class ThreeDCameraIllusionRotation(ThreeDScene):def construct(self):axes = ThreeDAxes()circle=Circle()@@ -62,10 +62,10 @@self.wait(PI)self.stop_3dillusion_camera_rotation()-.. manim:: ThreeDParametricSpringExample+.. manim:: ThreeDParametricSpring:save_last_frame:- class ThreeDParametricSpringExample(ThreeDScene):+ class ThreeDParametricSpring(ThreeDScene):def construct(self):curve1 = ParametricFunction(lambda u: np.array([@@ -79,9 +79,9 @@self.set_camera_orientation(phi=80 * DEGREES, theta=-60 * DEGREES)self.wait()-.. manim:: ThreeDFunctionExample+.. manim:: ThreeDFunctionPlot- class ThreeDFunctionExample(ThreeDScene):+ class ThreeDFunctionPlot(ThreeDScene):def construct(self):diff --git a/docs/source/examples/advanced_projects.rst b/docs/source/examples/advanced_projects.rstindex 283c119f7..480d03e7f 100644--- a/docs/source/examples/advanced_projects.rst+++ b/docs/source/examples/advanced_projects.rst@@ -1,10 +1,10 @@Advanced Projects=================================-.. manim:: OpeningManimExample+.. manim:: OpeningManim:quality: low- class OpeningManimExample(Scene):+ class OpeningManim(Scene):def construct(self):title = Tex("This is some \\LaTeX")basel = MathTex("\\sum_{n=1}^\\infty " "\\frac{1}{n^2} = \\frac{\\pi^2}{6}")@@ -104,10 +104,10 @@ Advanced Projectsself.play(Write(example_tex))self.wait()-.. manim:: UpdatersExample+.. manim:: SquareMovingWithUpdaters:quality: low- class UpdatersExample(Scene):+ class SquareMovingWithUpdaters(Scene):def construct(self):decimal = DecimalNumber(0,@@ -129,10 +129,10 @@ Advanced Projectsself.wait()-.. manim:: VDictExample+.. manim:: ShapesWithVDics:quality: low- class VDictExample(Scene):+ class ShapesWithVDics(Scene):def construct(self):square = Square().set_color(RED)circle = Circle().set_color(YELLOW).next_to(square, UP)@@ -196,10 +196,10 @@ Advanced Projectsself.wait()-.. manim:: VariableExample+.. manim:: VariablesWithValueTracker:quality: low- class VariableExample(Scene):+ class VariablesWithValueTracker(Scene):def construct(self):var = 0.5on_screen_var = Variable(var, Text("var"), num_decimal_places=3)@@ -242,9 +242,9 @@ Advanced Projectsself.play(Write(on_screen_subscript_var))self.wait()-.. manim:: ExampleSineCurve+.. manim:: SineCurvePlot- class ExampleSineCurve(Scene):+ class SineCurvePlot(Scene):# contributed by heejin_park, https://infograph.tistory.com/230def construct(self):self.show_axis()diff --git a/docs/source/examples/animations.rst b/docs/source/examples/animations.rstindex 2121afdcf..4ab3c7b8d 100644--- a/docs/source/examples/animations.rst+++ b/docs/source/examples/animations.rst@@ -10,9 +10,9 @@ Some more examples will come soon here!Updaters##########-.. manim:: RotationUpdaterExample+.. manim:: RotationUpdater- class RotationUpdaterExample(Scene):+ class RotationUpdater(Scene):def construct(self):def my_rotation_updater(mobj,dt):mobj.rotate_about_origin(dt)@@ -22,9 +22,9 @@ Updatersself.add(line_reference, line_moving)self.wait(PI)-.. manim:: RotationUpdater2Example+.. manim:: RotationUpdater2- class RotationUpdater2Example(Scene):+ class RotationUpdater2(Scene):def construct(self):def updater_forth(mobj, dt):mobj.rotate_about_origin(dt)@@ -41,9 +41,9 @@ Updatersline_moving.remove_updater(updater_back)self.wait(0.5)-.. manim:: NumberLinePointerExample+.. manim:: NumberLinePointer- class NumberLinePointerExample(Scene):+ class NumberLinePointer(Scene):def construct(self):number_line = NumberLine() ##with all your parameters and stuffpointer = Vector(DOWN)@@ -59,9 +59,9 @@ Updatersself.play(pointer_value.set_value, 3)self.wait()-.. manim:: SnakeExample+.. manim:: PointWithTrace- class SnakeExample(Scene):+ class PointWithTrace(Scene):def construct(self):path = VMobject()dot = Dot()@@ -78,9 +78,9 @@ Updatersself.play(dot.shift, LEFT)self.wait()-.. manim:: ValTracker1Example+.. manim:: PointMovingWithValTracker- class ValTracker1Example(Scene):+ class PointMovingWithValTracker(Scene):def construct(self):dot_disp = Dot().set_color(RED)self.add(dot_disp)@@ -93,9 +93,9 @@ Updatersself.play(val_tracker.set_value, tick_end, rate_func=linear)self.wait()-.. manim:: ValTracker2Example+.. manim:: RotationValTracker- class ValTracker2Example(Scene):+ class RotationValTracker(Scene):def construct(self):tick_start = 0tick_end = 2 * PI@@ -108,9 +108,9 @@ Updatersself.add(line_reference, line_moving)self.play(val_tracker.set_value, tick_end, run_time=PI)-.. manim:: PlaneFadeOutExample+.. manim:: PlaneFadeOut- class PlaneFadeOutExample(Scene):+ class PlaneFadeOut(Scene):def construct(self):@@ -131,9 +131,9 @@ Updatersself.play(FadeOut(sq1),FadeOut(sq2),FadeOut(sq3))self.wait()-.. manim:: FadeInAndOutExample+.. manim:: FadeInAndOut- class FadeInAndOutExample(Scene):+ class FadeInAndOut(Scene):def construct(self):square = Square(color=BLUE).shift(2*UP)diff --git a/docs/source/examples/annotations.rst b/docs/source/examples/annotations.rstindex 89dd0ad60..746d53166 100644--- a/docs/source/examples/annotations.rst+++ b/docs/source/examples/annotations.rst@@ -1,10 +1,10 @@Annotations=================================-.. manim:: AnnotateBrace+.. manim:: BraceAnnotation:save_last_frame:- class AnnotateBrace(Scene):+ class BraceAnnotation(Scene):def construct(self):dot = Dot([0, 0, 0])dot2 = Dot([2, 1, 0])@@ -15,11 +15,11 @@ Annotationsb2text = b2.get_tex("x-x_1")self.add(dot, dot2, line, b1, b2, b1text, b2text)-.. manim:: ExampleArrow+.. manim:: VectorArrow:quality: medium:save_last_frame:- class ExampleArrow(Scene):+ class VectorArrow(Scene):def construct(self):dot = Dot(ORIGIN)arrow = Arrow(ORIGIN, [2, 2, 0], buff=0)@@ -28,13 +28,13 @@ Annotationstip_text = Text('(2, 2)').next_to(arrow.get_end(), RIGHT)self.add(numberplane, dot, arrow, origin_text, tip_text)-.. manim:: ExampleArrowTips+.. manim:: ArrowTipsShowcase:quality: medium:save_last_frame:from manim.mobject.geometry import ArrowTriangleTip, ArrowSquareTip, ArrowSquareFilledTip,\ArrowCircleTip, ArrowCircleFilledTip- class ExampleArrowTips(Scene):+ class ArrowTipsShowcase(Scene):def construct(self):a00 = Arrow(start=[-2, 3, 0], end=[2, 3, 0], color=YELLOW)a11 = Arrow(start=[-2, 2, 0], end=[2, 2, 0], tip_shape=ArrowTriangleTip)diff --git a/docs/source/examples/camera_settings.rst b/docs/source/examples/camera_settings.rstindex 86a92bd98..f19a385b0 100644--- a/docs/source/examples/camera_settings.rst+++ b/docs/source/examples/camera_settings.rst@@ -1,18 +1,18 @@Camera Settings=================================-.. manim:: Example1+.. manim:: ChangingCameraWidth- class Example1(MovingCameraScene):+ class ChangingCameraWidth(MovingCameraScene):def construct(self):text = Text("Hello World")self.add(text)self.play(self.camera_frame.set_width, text.get_width() * 1.2)self.wait()-.. manim:: Example2a+.. manim:: ChangingCameraWidthAndRestore- class Example2a(MovingCameraScene):+ class ChangingCameraWidthAndRestore(MovingCameraScene):def construct(self):text = Text("Hello World").set_color(BLUE)self.add(text)@@ -21,9 +21,9 @@ Camera Settingsself.wait(0.3)self.play(Restore(self.camera_frame))-.. manim:: Example2b+.. manim:: ChangingCameraWidthAndRevert- class Example2b(MovingCameraScene):+ class ChangingCameraWidthAndRevert(MovingCameraScene):def construct(self):text = Text("Hello World").set_color(BLUE)self.add(text)@@ -32,20 +32,21 @@ Camera Settingsself.play(self.camera_frame.set_width, 14)-.. manim:: Example3+.. manim:: MovingCameraCenter- class Example3(MovingCameraScene):+ class MovingCameraCenter(MovingCameraScene):def construct(self):s = Square(color=RED, fill_opacity=0.5).move_to(2 * LEFT)t = Triangle(color=GREEN, fill_opacity=0.5).move_to(2 * RIGHT)+ self.wait(0.3)self.add(s, t)self.play(self.camera_frame.move_to, s)self.wait(0.3)self.play(self.camera_frame.move_to, t)-.. manim:: Example4+.. manim:: MovingAndZoomingCamera- class Example4(MovingCameraScene):+ class MovingAndZoomingCamera(MovingCameraScene):def construct(self):s = Square(color=BLUE, fill_opacity=0.5).move_to(2 * LEFT)t = Triangle(color=YELLOW, fill_opacity=0.5).move_to(2 * RIGHT)@@ -59,9 +60,9 @@ Camera Settingsself.play(self.camera_frame.move_to, ORIGIN,self.camera_frame.set_width,14)-.. manim:: Example5+.. manim:: MovingCameraOnGraph- class Example5(GraphScene, MovingCameraScene):+ class MovingCameraOnGraph(GraphScene, MovingCameraScene):def setup(self):GraphScene.setup(self)MovingCameraScene.setup(self)@@ -81,9 +82,9 @@ Camera Settingsself.play(Restore(self.camera_frame))self.wait()-.. manim:: Example6+.. manim:: FollowingGraphCamera- class Example6(GraphScene, MovingCameraScene):+ class FollowingGraphCamera(GraphScene, MovingCameraScene):def setup(self):GraphScene.setup(self)MovingCameraScene.setup(self)@@ -115,9 +116,9 @@ Camera SettingsNote: ZoomedScene is derived class of MovingCameraScene,so one can use all functionality that were used before in the MovingCameraScene examples.-.. manim:: ExampleZoom1+.. manim:: UseZoomedScene- class ExampleZoom1(ZoomedScene):+ class UseZoomedScene(ZoomedScene):def construct(self):dot = Dot().set_color(GREEN)self.add(dot)@@ -126,9 +127,9 @@ so one can use all functionality that were used before in the MovingCameraSceneself.wait(1)self.play(dot.shift, LEFT)-.. manim:: ExampleZoom2+.. manim:: ChangingZoomScale- class ExampleZoom2(ZoomedScene):+ class ChangingZoomScale(ZoomedScene):CONFIG = {"zoom_factor": 0.3,"zoomed_display_height": 1,@@ -151,9 +152,9 @@ so one can use all functionality that were used before in the MovingCameraSceneself.play(self.zoomed_camera.frame.shift, 0.5 * DOWN)-.. manim:: ExampleZoom3+.. manim:: MovingZoomedSceneAround- class ExampleZoom3(ZoomedScene):+ class MovingZoomedSceneAround(ZoomedScene):# contributed by TheoremofBeethoven, www.youtube.com/c/TheoremofBeethovenCONFIG = {"zoom_factor": 0.3,@@ -191,12 +192,12 @@ so one can use all functionality that were used before in the MovingCameraSceneframe_text.next_to(frame, DOWN)- self.play(ShowCreation(frame), FadeInFromDown(frame_text))+ self.play(ShowCreation(frame), FadeInFrom(frame_text,direction=DOWN))self.activate_zooming()self.play(self.get_zoomed_display_pop_out_animation(), unfold_camera)zoomed_camera_text.next_to(zoomed_display_frame, DOWN)- self.play(FadeInFromDown(zoomed_camera_text))+ self.play(FadeInFrom(zoomed_camera_text,direction=DOWN))# Scale in x y zscale_factor = [0.5, 1.5, 0]self.play(diff --git a/docs/source/examples/formulas.rst b/docs/source/examples/formulas.rstindex 5f615f963..9642fa4a1 100644--- a/docs/source/examples/formulas.rst+++ b/docs/source/examples/formulas.rst@@ -4,9 +4,9 @@ Formulas-.. manim:: MoveFrameBox+.. manim:: MovingFrameBox- class MoveFrameBox(Scene):+ class MovingFrameBox(Scene):def construct(self):text=MathTex("\\frac{d}{dx}f(x)g(x)=","f(x)\\frac{d}{dx}g(x)","+",@@ -24,9 +24,9 @@ Formulas)self.wait()-.. manim:: MoveBraces+.. manim:: MovingBraces- class MoveBraces(Scene):+ class MovingBraces(Scene):def construct(self):text=MathTex("\\frac{d}{dx}f(x)g(x)=", #0diff --git a/docs/source/examples/plots.rst b/docs/source/examples/plots.rstindex 2d5dc4ea7..0e1de60b2 100644--- a/docs/source/examples/plots.rst+++ b/docs/source/examples/plots.rst@@ -4,19 +4,19 @@ Plotting with manimExamples to illustrate the use of :class:`.GraphScene` in manim.-.. manim:: Plot1+.. manim:: FunctionPlot:save_last_frame:- class Plot1(GraphScene):+ class FunctionPlot(GraphScene):def construct(self):self.setup_axes()func_graph=self.get_graph(lambda x: np.sin(x))self.add(func_graph)-.. manim:: Plot2yLabelNumbers+.. manim:: FunctionPlotWithLabbeledYAxe:save_last_frame:- class Plot2yLabelNumbers(GraphScene):+ class FunctionPlotWithLabbeledYAxe(GraphScene):CONFIG = {"y_min": 0,"y_max": 100,@@ -30,10 +30,10 @@ Examples to illustrate the use of :class:`.GraphScene` in manim.func_graph = self.get_graph(lambda x: 20 * np.sin(x))self.add(dot,func_graph)-.. manim:: Plot3DataPoints+.. manim:: SequencePlot:save_last_frame:- class Plot3DataPoints(GraphScene):+ class SequencePlot(GraphScene):CONFIG = {"y_axis_label": r"Concentration [\%]","x_axis_label": "Time [s]",@@ -46,7 +46,7 @@ Examples to illustrate the use of :class:`.GraphScene` in manim.dot = Dot().move_to(self.coords_to_point(time, dat))self.add(dot)-.. manim:: Plot3bGaussian+.. manim:: GaussianFunctionPlot1:save_last_frame:amp = 5@@ -56,16 +56,17 @@ Examples to illustrate the use of :class:`.GraphScene` in manim.def gaussian(x):return amp * np.exp((-1 / 2 * ((x - mu) / sig) ** 2))- class Plot3bGaussian(GraphScene):+ class GaussianFunctionPlot1(GraphScene):def construct(self):self.setup_axes()- graph = self.get_graph(gaussian, x_min=-1, x_max=10).set_stroke(width=5)+ graph = self.get_graph(gaussian, x_min=-1, x_max=10)+ graph.set_stroke(width=5)self.add(graph)-.. manim:: Plot3cGaussian+.. manim:: GaussianFunctionPlot2:save_last_frame:- class Plot3cGaussian(GraphScene):+ class GaussianFunctionPlot2(GraphScene):def construct(self):def gaussian(x):amp = 5@@ -78,10 +79,10 @@ Examples to illustrate the use of :class:`.GraphScene` in manim.self.add(graph)-.. manim:: Plot4SinCos+.. manim:: SinAndCosFunctionPlot:save_last_frame:- class Plot4SinCos(GraphScene):+ class SinAndCosFunctionPlot(GraphScene):CONFIG = {"x_min": -10,"x_max": 10.3,@@ -107,10 +108,10 @@ Examples to illustrate the use of :class:`.GraphScene` in manim.two_pi.next_to(label_coord, RIGHT + UP)self.add(func_graph, func_graph2, vert_line, graph_lab, graph_lab2, two_pi)-.. manim:: Plot5Area+.. manim:: GraphAreaPlot:save_last_frame:- class Plot5Area(GraphScene):+ class GraphAreaPlot(GraphScene):CONFIG = {"x_min" : 0,"x_max" : 5,@@ -130,10 +131,10 @@ Examples to illustrate the use of :class:`.GraphScene` in manim.area2 = self.get_area(curve2, 2, 3, bounded=curve1)self.add(curve1, curve2, line1, line2, area1, area2)-.. manim:: Plot6HeatDiagram+.. manim:: HeatDiagramPlot:save_last_frame:- class Plot6HeatDiagram(GraphScene):+ class HeatDiagramPlot(GraphScene):CONFIG = {"y_axis_label": r"T[$^\circ C$]","x_axis_label": r"$\Delta Q$",diff --git a/docs/source/examples/shapes_images_positions.rst b/docs/source/examples/shapes_images_positions.rstindex fa8447ef5..67b55cf00 100644--- a/docs/source/examples/shapes_images_positions.rst+++ b/docs/source/examples/shapes_images_positions.rst@@ -1,10 +1,10 @@Shapes, Images and Positions=================================-.. manim:: GeometricShapesExample+.. manim:: GeometricShapes:save_last_frame:- class GeometricShapesExample(Scene):+ class GeometricShapes(Scene):def construct(self):d = Dot()c = Circle()@@ -17,9 +17,9 @@ Shapes, Images and Positionsself.wait()-.. manim:: ShapesExample+.. manim:: PointMovingOnShapes- class ShapesExample(Scene):+ class PointMovingOnShapes(Scene):def construct(self):@@ -40,21 +40,10 @@ Shapes, Images and Positionsself.wait()-.. manim:: ImageFromArrayExample- :save_last_frame:-- class ImageFromArrayExample(Scene):- def construct(self):- image = ImageMobject(np.uint8([[0, 100, 30, 200],- [255, 0, 5, 33]]))- image.set_height(7)- self.add(image)---.. manim:: GradientImageFromArrayExample+.. manim:: GradientImageFromArray:save_last_frame:- class GradientImageFromArrayExample(Scene):+ class GradientImageFromArray(Scene):def construct(self):n = 256imageArray = np.uint8([[i*256/n for i in range(0,n)] for _ in range(0,n)])@@ -62,15 +51,15 @@ Shapes, Images and Positionsself.add(image)-.. manim:: ImageFromFileExample+.. manim:: ImageFromFile:save_last_frame:- class ImageFromFileExample(Scene):+ class ImageFromFile(Scene):def construct(self):# Use PIL when you want to import an image from the webimport requestsfrom PIL import Image- img = Image.open(requests.get("https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/logoWAlpha.png",+ img = Image.open(requests.get("https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/logoBAlpha.png",stream=True).raw)img_mobject = ImageMobject(img)# this line, when you want to import your Image on your machine@@ -79,10 +68,10 @@ Shapes, Images and Positionsself.add(img_mobject)-.. manim:: ArcShapeExample+.. manim:: ArcShapeIris:save_last_frame:- class ArcShapeExample(Scene):+ class ArcShapeIris(Scene):def construct(self):colors = [DARK_BLUE , DARK_BROWN, BLUE_E, BLUE_D, BLUE_A, TEAL_B, GREEN_B, YELLOW_E]radius = [1+rad*0.1 for rad in range(len(colors))]@@ -96,10 +85,10 @@ Shapes, Images and Positionsself.add(circles_group)-.. manim:: InterpolationExample+.. manim:: DotInterpolation:save_last_frame:- class InterpolationExample(Scene):+ class DotInterpolation(Scene):def construct(self):dotL = Dot(color=DARK_GREY)dotL.shift(2*RIGHT)@@ -111,9 +100,9 @@ Shapes, Images and Positionsself.add(dotL, dotR, dotMiddle)-.. manim:: MoveAroundExample+.. manim:: MovingAround- class MoveAroundExample(Scene):+ class MovingAround(Scene):def construct(self):square = Square(color=BLUE,fill_opacity=1)@@ -123,10 +112,10 @@ Shapes, Images and Positionsself.play(square.rotate,0.4)-.. manim:: TextAlignementExample+.. manim:: TextAlignement:save_last_frame:- class TextAlignementExample(Scene):+ class TextAlignement(Scene):def construct(self):title=PangoText("K-means clustering and Logistic Regression", color=WHITE)title.scale_in_place(0.75)@@ -150,10 +139,10 @@ Shapes, Images and Positionsself.add(x)-.. manim:: SplineExample+.. manim:: BezierSpline:save_last_frame:- class SplineExample(Scene):+ class BezierSpline(Scene):def construct(self):np.random.seed(42)diff --git a/docs/source/examples/tex.rst b/docs/source/examples/tex.rstindex a64505931..57a00e06e 100644--- a/docs/source/examples/tex.rst+++ b/docs/source/examples/tex.rst@@ -10,10 +10,10 @@ A newer addition to manim is the :class:`~.PangoText` class, which uses the PangThe Text() mobject+++++++++++++++++++-.. manim:: Example1Text+.. manim:: HelloWorld:save_last_frame:- class Example1Text(Scene):+ class HelloWorld(Scene):def construct(self):text = Text('Hello world').scale(3)self.add(text)@@ -33,10 +33,10 @@ The Tex() mobject+++++++++++++++++++Just as you can use :class:`~.Text` to add text to your videos, you can use :class:`~.Tex` to insert LaTeX.-.. manim:: ExampleLaTeX+.. manim:: HelloLaTeX:save_last_frame:- class ExampleLaTeX(Scene):+ class HelloLaTeX(Scene):def construct(self):tex = Tex(r'\LaTeX').scale(3)self.add(tex)@@ -50,10 +50,10 @@ The MathTex() mobject++++++++++++++++++++++Anything enclosed in ``$`` signs is interpreted as maths-mode:-.. manim:: Example1LaTeX+.. manim:: HelloTex:save_last_frame:- class Example1LaTeX(Scene):+ class HelloTex(Scene):def construct(self):tex = Tex(r'$\xrightarrow{Hello}$ \LaTeX').scale(3)self.add(tex)@@ -61,10 +61,10 @@ Anything enclosed in ``$`` signs is interpreted as maths-mode:Whereas in a :class:`~.MathTex` mobject everything is math-mode by default and you would use ``\text{}`` toinsert regular text:-.. manim:: Example1bLaTeX+.. manim:: HelloMathTex:save_last_frame:- class Example1bLaTeX(Scene):+ class HelloMathTex(Scene):def construct(self):tex = MathTex(r'\xrightarrow{Hello}\text{ \LaTeX}').scale(3)self.add(tex)@@ -73,10 +73,10 @@ LaTeX commands and keyword arguments+++++++++++++++++++++++++++++++++++++We can use any standard LaTeX commands in the AMS maths packages. For example the ``mathtt`` text type.-.. manim:: Example2LaTeX+.. manim:: AMSLaTeX:save_last_frame:- class Example2LaTeX(Scene):+ class AMSLaTeX(Scene):def construct(self):tex = Tex(r'$\mathtt{Hello}$ \LaTeX').scale(3)self.add(tex)@@ -84,10 +84,10 @@ We can use any standard LaTeX commands in the AMS maths packages. For example thOn the manim side, the :class:`~.Tex` class also accepts attributes to change the appearance of the output.This is very similar to the :class:`~.Text` class. For example, the ``color`` keyword changes the color of the TeX mobject:-.. manim:: Example2bLaTeX+.. manim:: LaTeXAttributes:save_last_frame:- class Example2bLaTeX(Scene):+ class LaTeXAttributes(Scene):def construct(self):tex = Tex(r'Hello \LaTeX', color=BLUE).scale(3)self.add(tex)@@ -98,10 +98,10 @@ Some commands require special packages to be loaded into the TeX template. For eto use the ``mathscr`` script, we need to add the ``mathrsfs`` package. Since this package isn't loadedinto manim's tex template by default, we add it manually:-.. manim:: Example3LaTeX+.. manim:: AddPackageLatex:save_last_frame:- class Example3LaTeX(Scene):+ class AddPackageLatex(Scene):def construct(self):myTemplate = TexTemplate()myTemplate.add_to_preamble(r"\usepackage{mathrsfs}")@@ -114,10 +114,10 @@ The TeX mobject can accept multiple strings as arguments. Afterwards you can refparts either by their index (like ``tex[1]``), or you can look them up by (parts of) the tex code likein this example where we set the color of the ``\bigstar`` using :func:`~.set_color_by_tex`:-.. manim:: Example4LaTeX+.. manim:: LaTeXSubstrings:save_last_frame:- class Example4LaTeX(Scene):+ class LaTeXSubstrings(Scene):def construct(self):tex = Tex('Hello', r'$\bigstar$', r'\LaTeX').scale(3)tex.set_color_by_tex('igsta', RED)@@ -130,10 +130,10 @@ with regular text. It requires changing the template that is used to compile theManim comes with a collection of :class:`~.TexFontTemplates` ready for you to use. These templates will all workin maths mode:-.. manim:: Example5LaTeX+.. manim:: LaTeXMathFonts:save_last_frame:- class Example5LaTeX(Scene):+ class LaTeXMathFonts(Scene):def construct(self):tex = Tex(r'$f: A \rightarrow B$', tex_template=TexFontTemplates.french_cursive).scale(3)self.add(tex)@@ -143,10 +143,10 @@ is the ctex template, used for typesetting Chinese. For this to work, the ctex Lmust be installed on your system. Furthermore, if you are only typesetting Text, you probably do notneed :class:`~.Tex` at all, and should use :class:`~.Text` or :class:`~.PangoText` instead.-.. manim:: Example6LaTeX+.. manim:: LaTeXTemplateLibrary:save_last_frame:- class Example6LaTeX(Scene):+ class LaTeXTemplateLibrary(Scene):def construct(self):tex = Tex('Hello 你好 \\LaTeX', tex_template=TexTemplateLibrary.ctex).scale(3)self.add(tex)@@ -157,10 +157,10 @@ Aligning formulaeA :class:`~.MathTex` mobject is typeset in the LaTeX ``align*`` environment. This means you can use the ``&`` alignmentcharacter when typesetting multiline formulae:-.. manim:: Example7LaTeX+.. manim:: LaTeXAlignEnvironment:save_last_frame:- class Example7LaTeX(Scene):+ class LaTeXAlignEnvironment(Scene):def construct(self):tex = MathTex(r'f(x) &= 3 + 2 + 1\\ &= 5 + 1 \\ &= 6').scale(2)self.add(tex)diff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.pyindex e0bb9c94f..6b7cfc30f 100644--- a/manim/mobject/types/image_mobject.py+++ b/manim/mobject/types/image_mobject.py@@ -49,6 +49,37 @@ class AbstractImageMobject(Mobject):class ImageMobject(AbstractImageMobject):+ """ Displays an Image from a numpy array or a file.++ Examples+ --------+ .. manim:: ImageFromArray+ :save_last_frame:++ class ImageFromArray(Scene):+ def construct(self):+ image = ImageMobject(np.uint8([[0, 100, 30, 200],+ [255, 0, 5, 33]]))+ image.set_height(7)+ self.add(image)++ .. manim:: ImageFromFile+ :save_last_frame:++ class ImageFromFile(Scene):+ def construct(self):+ # Use PIL when you want to import an image from the web+ import requests+ from PIL import Image+ img = Image.open(requests.get("https://raw.githubusercontent.com/ManimCommunity/manim/master/logo/logoB.png",+ stream=True).raw)+ img_mobject = ImageMobject(img)+ # this line, when you want to import your Image on your machine+ # img_mobject = ImageMobject("<your image address>")+ img_mobject.scale(3)+ self.add(img_mobject)++ """CONFIG = {"invert": False,"image_mode": "RGBA",