Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added docs to docstrings

MysaaJavabd1f50790c5c
diff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.py
index e0bb9c94f..1210541fa 100644
--- a/manim/mobject/types/image_mobject.py
+++ b/manim/mobject/types/image_mobject.py
@@ -49,6 +49,38 @@ 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/cropped.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",
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index 108725cf6..5ccfcf79c 100644
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -781,8 +781,10 @@ class Scene(Container):
Parameters
----------
- *args : Animation or mobject with mobject method and params
- **kwargs : named parameters affecting what was passed in *args e.g run_time, lag_ratio etc.
+ args
+ Animation or mobject with mobject method and params
+ kwargs
+ named parameters affecting what was passed in ``args`` e.g. ``run_time``, ``lag_ratio`` etc.
"""
if len(args) == 0:
warnings.warn("Called Scene.play with no animations")