1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
from manimlib.imports import *
class Examples(GraphScene):
def construct(self):
rectangle = Rectangle(height = 3, width = 4, color = GREEN)
square = Square(side_length = 5, color = PURPLE)
circle = Circle(radius = 2, color = PINK)
radius = Line(ORIGIN,2*RIGHT)
radius.set_color(RED)
rectangle_area_func = TextMobject(r"$Area = f(Length, Breadth)$")
rectangle_area_func.scale(0.6)
square_area_func = TextMobject(r"$Area = f(Length)$")
circle_area_func = TextMobject(r"$Area = f(r)$")
rectangle_area = TextMobject(r"$Area = Length \times Breadth$")
rectangle_area.scale(0.6)
square_area = TextMobject(r"$Area = Length^2$")
circle_area = TextMobject(r"$Area = \pi r^2$")
braces_rect1 = Brace(rectangle, LEFT)
eq_text1 = braces_rect1.get_text("Length")
braces_rect2 = Brace(rectangle, UP)
eq_text2 = braces_rect2.get_text("Breadth")
braces_square = Brace(square, LEFT)
braces_square_text = braces_square.get_text("Length")
radius_text = TextMobject("r")
radius_text.next_to(radius,UP)
self.play(ShowCreation(rectangle))
self.wait(1)
self.play(GrowFromCenter(braces_rect1),Write(eq_text1),GrowFromCenter(braces_rect2),Write(eq_text2))
self.wait(1)
self.play(Write(rectangle_area_func))
self.wait(1)
self.play(Transform(rectangle_area_func, rectangle_area))
self.wait(1)
self.play(FadeOut(braces_rect1),FadeOut(eq_text1),FadeOut(braces_rect2),FadeOut(eq_text2),FadeOut(rectangle_area_func))
self.play(Transform(rectangle, square))
self.wait(1)
self.play(GrowFromCenter(braces_square),Write(braces_square_text))
self.wait(1)
self.play(Write(square_area_func))
self.wait(1)
self.play(Transform(square_area_func, square_area))
self.wait(1)
self.play(FadeOut(braces_square),FadeOut(braces_square_text),FadeOut(square_area_func))
self.play(Transform(rectangle, circle))
self.wait(1)
self.play(ShowCreation(radius),Write(radius_text))
self.wait(1)
self.play(FadeOut(radius_text),FadeOut(radius))
self.wait(1)
self.play(Write(circle_area_func))
self.wait(1)
self.play(Transform(circle_area_func, circle_area))
self.wait(1)
self.play(FadeOut(circle_area_func))
|