Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add an example to shape_matchers.py (#1644)

Ujjayanta872efca5866b
diff --git a/manim/mobject/shape_matchers.py b/manim/mobject/shape_matchers.py
index b1df0c45f..4c716d312 100644
--- a/manim/mobject/shape_matchers.py
+++ b/manim/mobject/shape_matchers.py
@@ -24,6 +24,30 @@ class SurroundingRectangle(Rectangle):
class BackgroundRectangle(SurroundingRectangle):
+ """A background rectangle
+
+ Examples
+ --------
+
+ .. manim:: ExampleBackgroundRectangle
+ :save_last_frame:
+
+ class ExampleBackgroundRectangle(Scene):
+ def construct(self):
+ circle = Circle().shift(LEFT)
+ circle.set_stroke(color=GREEN, width=20)
+ triangle = Triangle().shift(2 * RIGHT)
+ triangle.set_fill(PINK, opacity=0.5)
+ backgroundRectangle1 = BackgroundRectangle(circle, color=WHITE, fill_opacity=0.15)
+ backgroundRectangle2 = BackgroundRectangle(triangle, color=WHITE, fill_opacity=0.15)
+ self.add(backgroundRectangle1)
+ self.add(backgroundRectangle2)
+ self.add(circle)
+ self.add(triangle)
+ self.play(Rotate(backgroundRectangle1, PI / 4))
+ self.play(Rotate(backgroundRectangle2, PI / 2))
+ """
+
def __init__(
self,
mobject,