├── README.md ├── Shapes.gif ├── Shapes.mp4 ├── assets ├── jf.png └── michel.png ├── img ├── DrawCircle.gif ├── DrawCircle.mp4 ├── Graphing.gif ├── Graphing.mp4 ├── UpdaterFunc.mp4 ├── dot_value_updater.gif ├── dot_value_updater.mp4 ├── final.mp4 ├── updaterfunc.gif ├── welcome.gif ├── welcome_1080.mp4 └── welcome_720.mp4 └── projects ├── acilis_ekrani.py ├── basic.py ├── dot_value_updater.py ├── drawcircle.py ├── final_ekrani.py ├── graphs.py ├── readme.MD └── updaterfunc.py /README.md: -------------------------------------------------------------------------------- 1 | # Manim Examples 2 | Bu repo [3Blue1Brown](https://www.youtube.com/3Blue1Brown) YouTube kanalında kullanılan harika animasyonların nasıl yapıldığıyla alakalı kodlar içermektedir. 3 | 4 | Burada yapılan tüm çalışmalar için [manim](https://github.com/3b1b/manim) reposunu ziyaret edebilirsiniz. Dökümantasyon ve kurulum yönergeleri adrestedir. 5 | 6 | [Mert Cobanov](https://www.youtube.com/MertCobanov) isimli YouTube kanalımda yakında animasyonları nasıl Python ile yazabileceğinizi anlatacağım bir eğitim serisi hazırlayacağım! 7 | 8 | ## Example: 9 | 10 |
11 | 12 | ## Note: 13 | Maalesef halen stable ve kolay kurulumlu bir kütüphane değil, birçok eksiği ve halledilmesi gereken problemi var. Dökümantasyonu tamamlanmış değil bu yüzden kodları okumanız gereken durumlar olabilir. Reddit ve GitHub'da komüniteyi takip edebilirsiniz. 14 | 15 | ## Run 16 | `python -m manim basic.py -pl` 17 | 18 | ## Projects: 19 | See other projects in [Projects](https://github.com/cobanov/manim_examples/tree/master/projects) folder. 20 | 21 | 22 | 23 | 24 | ### Video to gif 25 | 26 | `ffmpeg -y -i input.mp4 -r 31 output.gif` 27 | -------------------------------------------------------------------------------- /Shapes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/Shapes.gif -------------------------------------------------------------------------------- /Shapes.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/Shapes.mp4 -------------------------------------------------------------------------------- /assets/jf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/assets/jf.png -------------------------------------------------------------------------------- /assets/michel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/assets/michel.png -------------------------------------------------------------------------------- /img/DrawCircle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/DrawCircle.gif -------------------------------------------------------------------------------- /img/DrawCircle.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/DrawCircle.mp4 -------------------------------------------------------------------------------- /img/Graphing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/Graphing.gif -------------------------------------------------------------------------------- /img/Graphing.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/Graphing.mp4 -------------------------------------------------------------------------------- /img/UpdaterFunc.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/UpdaterFunc.mp4 -------------------------------------------------------------------------------- /img/dot_value_updater.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/dot_value_updater.gif -------------------------------------------------------------------------------- /img/dot_value_updater.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/dot_value_updater.mp4 -------------------------------------------------------------------------------- /img/final.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/final.mp4 -------------------------------------------------------------------------------- /img/updaterfunc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/updaterfunc.gif -------------------------------------------------------------------------------- /img/welcome.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/welcome.gif -------------------------------------------------------------------------------- /img/welcome_1080.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/welcome_1080.mp4 -------------------------------------------------------------------------------- /img/welcome_720.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobanov/manim_examples/785ed2ffeab10625afcd53811403dde084eadff0/img/welcome_720.mp4 -------------------------------------------------------------------------------- /projects/acilis_ekrani.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | 3 | 4 | class MoveText(Scene): 5 | def construct(self): 6 | 7 | circle = Circle(color=BLUE) 8 | circle.move_to(0.5*UP) 9 | circle.scale(1.7) 10 | 11 | circle2 = Circle(radius=1, color=BLUE) 12 | circle2.move_to(0.5*UP) 13 | circle2.scale(1) 14 | 15 | text = TextMobject("Mert Cobanov") 16 | text.scale(0.7) 17 | text.to_corner(DR) 18 | 19 | text2 = TextMobject("Data Science") 20 | text2.scale(2) 21 | text2.move_to(2*DOWN) 22 | 23 | jf = ImageMobject("C:\\manim\\assets\\jf.png") 24 | jf.scale(1.7) 25 | jf.move_to(UP) 26 | 27 | # michel = ImageMobject("C:\\manim\\assets\\michel.png") 28 | # michel.scale(1.7) 29 | # michel.move_to(UP) 30 | 31 | self.play(Write(circle), FadeIn(jf), Write(text2), Write(text), run_time=2) 32 | self.play(FadeOut(jf),FadeOut(text),FadeOut(text2)) 33 | self.play(ReplacementTransform(circle, circle2), run_time=0.7) 34 | 35 | self.wait() -------------------------------------------------------------------------------- /projects/basic.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | 3 | class Shapes(Scene): 4 | def construct(self): 5 | 6 | circle = Circle(color=YELLOW) 7 | square = Square(color=DARK_BLUE) 8 | square.surround(circle) 9 | text = Text("Mert Cobanov") 10 | text2 = Text("Deep Learning Türkiye") 11 | 12 | rectangle = Rectangle(height=2, width=3, color=RED) 13 | 14 | #Showing animation 15 | self.add(circle) 16 | self.play(FadeIn(square)) 17 | self.play(Transform(square, rectangle)) 18 | self.play(FadeOut(circle)) 19 | self.play(ReplacementTransform(square, text)) 20 | self.wait(0.5) 21 | self.play(ReplacementTransform(text, text2)) 22 | self.wait(1) -------------------------------------------------------------------------------- /projects/dot_value_updater.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | 3 | class DrawCircle(Scene): 4 | 5 | 6 | def construct(self): 7 | coords = [(0,-1,0), (-2,-1,0), (2,-1,0)] 8 | 9 | line = Line() 10 | decimal_x = DecimalNumber().move_to(UP) 11 | decimal_y = DecimalNumber().next_to(decimal_x, DOWN) 12 | 13 | 14 | dot = Dot(color=YELLOW) 15 | 16 | def line_updater(obj): 17 | line2 = Line(ORIGIN, dot.get_center()) 18 | line.become(line2) 19 | 20 | def set_value_decimal_x(obj): 21 | obj.set_value(dot.get_center()[0]) 22 | 23 | def set_value_decimal_y(obj): 24 | obj.set_value(dot.get_center()[1]) 25 | 26 | 27 | decimal_x.add_updater(set_value_decimal_x) 28 | decimal_y.add_updater(set_value_decimal_y) 29 | 30 | line.add_updater(line_updater) 31 | 32 | self.add(decimal_x, decimal_y, dot, line) 33 | 34 | for coord in coords: 35 | self.play(ApplyMethod(dot.move_to, coord)) 36 | self.wait(0.5) 37 | 38 | 39 | self.wait(2) 40 | 41 | -------------------------------------------------------------------------------- /projects/drawcircle.py: -------------------------------------------------------------------------------- 1 | class TriangleScene(Scene): 2 | def construct(self): 3 | circle = Circle(radius=3) 4 | base_line = Line(ORIGIN,RIGHT*3,color=ORANGE) 5 | side_1 = Line(ORIGIN,RIGHT*3,color=BLUE) 6 | side_2 = Line(RIGHT*3,RIGHT*3,color=PURPLE) 7 | sides = VGroup(side_1,side_2) 8 | 9 | def triangle_update(mob): 10 | side_1,side_2 = mob 11 | new_side_1 = Line(ORIGIN,circle.points[-1],color=BLUE) 12 | new_side_2 = Line(RIGHT*3,circle.points[-1],color=PURPLE) 13 | side_1.become(new_side_1) 14 | side_2.become(new_side_2) 15 | 16 | sides.add_updater(triangle_update) 17 | self.add(base_line,sides) 18 | self.play(ShowCreation(circle,run_time=3)) 19 | 20 | self.wait() -------------------------------------------------------------------------------- /projects/final_ekrani.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | 3 | class Shapes(Scene): 4 | def construct(self): 5 | 6 | circle = Circle(color=YELLOW) 7 | square = Square(color=DARK_BLUE) 8 | square.surround(circle) 9 | text = Text("Mert Cobanov") 10 | text2 = Text("Deep Learning Türkiye") 11 | 12 | rectangle = Rectangle(height=2, width=3, color=RED) 13 | 14 | #Showing animation 15 | self.add(circle) 16 | self.play(FadeIn(square)) 17 | self.play(Transform(square, rectangle)) 18 | self.play(FadeOut(circle)) 19 | self.play(ReplacementTransform(square, text)) 20 | self.wait(0.5) 21 | self.play(ReplacementTransform(text, text2)) 22 | self.wait(1) -------------------------------------------------------------------------------- /projects/graphs.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | import math 3 | 4 | ## Bu proje https://github.com/malhotra5/Manim-Tutorial adresinden alınmıştır. 5 | ## This project is forked from https://github.com/malhotra5/Manim-Tutorial 6 | 7 | 8 | class Graphing(GraphScene): 9 | CONFIG = { 10 | "x_min": -5, 11 | "x_max": 5, 12 | "y_min": -4, 13 | "y_max": 4, 14 | "graph_origin": ORIGIN, 15 | "function_color": WHITE, 16 | "axes_color": BLUE 17 | } 18 | 19 | def construct(self): 20 | #Make graph 21 | self.setup_axes(animate=True) 22 | func_graph=self.get_graph(self.func_to_graph,self.function_color) 23 | graph_lab = self.get_graph_label(func_graph, label = "x^{2}") 24 | 25 | func_graph_2=self.get_graph(self.func_to_graph_2,self.function_color) 26 | graph_lab_2 = self.get_graph_label(func_graph_2, label = "x^{3}") 27 | 28 | vert_line = self.get_vertical_line_to_graph(1,func_graph,color=YELLOW) 29 | 30 | x = self.coords_to_point(1, self.func_to_graph(1)) 31 | y = self.coords_to_point(0, self.func_to_graph(1)) 32 | horz_line = Line(x,y, color=YELLOW) 33 | 34 | point = Dot(self.coords_to_point(1,self.func_to_graph(1))) 35 | 36 | #Display graph 37 | self.play(ShowCreation(func_graph), Write(graph_lab)) 38 | self.wait(1) 39 | self.play(ShowCreation(vert_line)) 40 | self.play(ShowCreation(horz_line)) 41 | self.add(point) 42 | self.wait(1) 43 | self.play(Transform(func_graph, func_graph_2), Transform(graph_lab, graph_lab_2)) 44 | self.wait(2) 45 | 46 | 47 | def func_to_graph(self, x): 48 | return (x**2) 49 | 50 | def func_to_graph_2(self, x): 51 | return(x**3) -------------------------------------------------------------------------------- /projects/readme.MD: -------------------------------------------------------------------------------- 1 | # Projects 2 | 3 | 4 | ## 1. Welcome 5 | 6 | 7 | 8 | ```python 9 | from manimlib.imports import * 10 | 11 | 12 | class MoveText(Scene): 13 | def construct(self): 14 | 15 | circle = Circle(color=BLUE) 16 | circle.move_to(0.5*UP) 17 | circle.scale(1.7) 18 | 19 | circle2 = Circle(radius=1, color=BLUE) 20 | circle2.move_to(0.5*UP) 21 | circle2.scale(1) 22 | 23 | text = TextMobject("Mert Cobanov") 24 | text.scale(0.7) 25 | text.to_corner(DR) 26 | 27 | text2 = TextMobject("Data Science") 28 | text2.scale(2) 29 | text2.move_to(2*DOWN) 30 | 31 | jf = ImageMobject("C:\\manim\\assets\\jf.png") 32 | jf.scale(1.7) 33 | jf.move_to(UP) 34 | 35 | # michel = ImageMobject("C:\\manim\\assets\\michel.png") 36 | # michel.scale(1.7) 37 | # michel.move_to(UP) 38 | 39 | self.play(Write(circle), FadeIn(jf), Write(text2), Write(text), run_time=2) 40 | self.play(FadeOut(jf),FadeOut(text),FadeOut(text2)) 41 | self.play(ReplacementTransform(circle, circle2), run_time=0.7) 42 | 43 | self.wait() 44 | ``` 45 | 46 | 47 | ## 2.Graphing 48 | 49 | 50 | 51 | ```python 52 | from manimlib.imports import * 53 | import math 54 | 55 | ## Bu proje https://github.com/malhotra5/Manim-Tutorial adresinden alınmıştır. 56 | ## This project is forked from https://github.com/malhotra5/Manim-Tutorial 57 | 58 | 59 | class Graphing(GraphScene): 60 | CONFIG = { 61 | "x_min": -5, 62 | "x_max": 5, 63 | "y_min": -4, 64 | "y_max": 4, 65 | "graph_origin": ORIGIN, 66 | "function_color": WHITE, 67 | "axes_color": BLUE 68 | } 69 | 70 | def construct(self): 71 | #Make graph 72 | self.setup_axes(animate=True) 73 | func_graph=self.get_graph(self.func_to_graph,self.function_color) 74 | graph_lab = self.get_graph_label(func_graph, label = "x^{2}") 75 | 76 | func_graph_2=self.get_graph(self.func_to_graph_2,self.function_color) 77 | graph_lab_2 = self.get_graph_label(func_graph_2, label = "x^{3}") 78 | 79 | vert_line = self.get_vertical_line_to_graph(1,func_graph,color=YELLOW) 80 | 81 | x = self.coords_to_point(1, self.func_to_graph(1)) 82 | y = self.coords_to_point(0, self.func_to_graph(1)) 83 | horz_line = Line(x,y, color=YELLOW) 84 | 85 | point = Dot(self.coords_to_point(1,self.func_to_graph(1))) 86 | 87 | #Display graph 88 | self.play(ShowCreation(func_graph), Write(graph_lab)) 89 | self.wait(1) 90 | self.play(ShowCreation(vert_line)) 91 | self.play(ShowCreation(horz_line)) 92 | self.add(point) 93 | self.wait(1) 94 | self.play(Transform(func_graph, func_graph_2), Transform(graph_lab, graph_lab_2)) 95 | self.wait(2) 96 | 97 | 98 | def func_to_graph(self, x): 99 | return (x**2) 100 | 101 | def func_to_graph_2(self, x): 102 | return(x**3) 103 | ``` 104 | ## 3. Updater Func 105 | 106 | 107 | 108 | ```python 109 | 110 | from manimlib.imports import * 111 | 112 | class UpdaterFunc(Scene): 113 | 114 | def construct(self): 115 | 116 | dot = Dot() 117 | number_x = DecimalNumber( include_sign=True).next_to(dot) 118 | number_y = DecimalNumber( include_sign=True).next_to(number_x, DOWN) 119 | 120 | def update_number_x(obj): 121 | obj.next_to(dot) 122 | 123 | obj.set_value(dot.get_center()[0]) 124 | 125 | def update_number_y(obj): 126 | obj.next_to(dot) 127 | obj.next_to(number_x,DOWN) 128 | obj.set_value(dot.get_center()[1]) 129 | 130 | number_x.add_updater(update_number_x) 131 | number_y.add_updater(update_number_y) 132 | 133 | self.add(dot, number_x, number_y) 134 | self.play(dot.shift, RIGHT, DOWN, run_time=2) 135 | self.play(Rotate(dot), about_point=ORIGIN, run_time=2) 136 | 137 | self.wait() 138 | 139 | ``` 140 | 141 | 142 | 143 | ## 4. Basic 144 | 145 | 146 | 147 | ```python 148 | from manimlib.imports import * 149 | 150 | class Shapes(Scene): 151 | def construct(self): 152 | 153 | circle = Circle(color=YELLOW) 154 | square = Square(color=DARK_BLUE) 155 | square.surround(circle) 156 | text = Text("Mert Cobanov") 157 | text2 = Text("Deep Learning Türkiye") 158 | 159 | rectangle = Rectangle(height=2, width=3, color=RED) 160 | 161 | #Showing animation 162 | self.add(circle) 163 | self.play(FadeIn(square)) 164 | self.play(Transform(square, rectangle)) 165 | self.play(FadeOut(circle)) 166 | self.play(ReplacementTransform(square, text)) 167 | self.wait(0.5) 168 | self.play(ReplacementTransform(text, text2)) 169 | self.wait(1) 170 | 171 | ``` -------------------------------------------------------------------------------- /projects/updaterfunc.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | 3 | class UpdaterFunc(Scene): 4 | 5 | def construct(self): 6 | 7 | dot = Dot() 8 | number_x = DecimalNumber( include_sign=True).next_to(dot) 9 | number_y = DecimalNumber( include_sign=True).next_to(number_x, DOWN) 10 | 11 | def update_number_x(obj): 12 | obj.next_to(dot) 13 | 14 | obj.set_value(dot.get_center()[0]) 15 | 16 | def update_number_y(obj): 17 | obj.next_to(dot) 18 | obj.next_to(number_x,DOWN) 19 | obj.set_value(dot.get_center()[1]) 20 | 21 | number_x.add_updater(update_number_x) 22 | number_y.add_updater(update_number_y) 23 | 24 | self.add(dot, number_x, number_y) 25 | self.play(dot.shift, RIGHT, DOWN, run_time=2) 26 | self.play(Rotate(dot), about_point=ORIGIN, run_time=2) 27 | 28 | self.wait() 29 | --------------------------------------------------------------------------------