본문 바로가기

분류 전체보기

(284)
[020]Vector/TangentLine Vector Class def get_vector_test(self): plane = NumberPlane() a = np.array([1,3,0]) b = np.array([2,2,0]) vector_a = Vector(a) vector_b = Vector(b) c = Arrow(a,b, buff=0) vector_c = Vector(c.get_vector()) self.add(plane) self.add(vector_a, vector_b, c) self.play(ShowCreation(vector_c)) self.wait() Line.get_unit_vector Line.get_angle class VectorTest(MovingCameraScene): def construct(self): self...
[019]Arrow/DoubleArrow Arrow arrow = Arrow() Arrow: draw arrow between two points arrow = Arrow(DOWN, UP) Arrow: buff, scale class Arrow_Buff(Scene): def construct(self): buff_changed = Arrow_Buff.get_buff_changed() scale_changed = Arrow_Buff.get_scale_changed() buff_changed.to_corner(UL, buff=1) buff_changed.arrange(DOWN, center=False, aligned_edge=LEFT) scale_changed.to_edge(UP, buff=1) scale_changed.arrange(DOWN, c..
[018]Line/DashedLine Line: draw simple line grid = self.get_grid(-7, 7, 1, -4, 4, 1) self.add(grid) line = Line(stroke_color=RED, stroke_width=8) self.add(line) self.wait() Line: draw line between two points a = np.array([-1,1,0]) b = np.array([1, -1, 0]) line = Line(a,b) self.add(line) self.wait() Line: stroke_color, stroke_width line = Line(stroke_color=RED, stroke_width=6) def change_stroke_width(self): def get_l..
[017]set_fill/set_stroke set_fill rect = Rectangle() rect.set_fill(RED_C, opacity=1) set_stroke (1) rect1 = Rectangle(width=2,height=2) rect1.set_fill(BLUE, opacity=1) rect2 = rect1.copy() rect2.next_to(rect1,RIGHT) dot1 = Dot(radius=0.3) dot2 = dot1.copy() dot1.set_stroke(RED_E,2,background=True) dot2.set_stroke(RED_E, 2, background=False) dot1.move_to(rect1) dot2.move_to(rect2) self.add(rect1,dot1,rect2,dot2) self.wai..
[016]Mobject Class Diagram
[015]Text: font size t1 = Text("Hello 0.1", font='굴림', stroke_width=1, size=0.1) t2 = Text("Hello 0.2", font='굴림', stroke_width=1, size=0.2) t3 = Text("Hello 0.3", font='굴림', stroke_width=1, size=0.3) t4 = Text("Hello 0.4", font='굴림', stroke_width=1, size=0.4) t5 = Text("Hello 0.5", font='굴림', stroke_width=1, size=0.5) t6 = Text("Hello 0.7 ", font='굴림', stroke_width=1, size=0.7) t7 = Text("Hello 1", font='굴림', strok..
[014]Text/TextMobject/TexMobject Text, TextMobject str = Text("페르마의 마지막 정리", font='바탕') text = TextMobject("방정식 $x^n + y^n = z^n$를 만족하는 $(x,y,z)$값이 존재하지 않는다") tex = TexMobject("x^n + y^n = z^n") group = VGroup(str,text, tex) group.arrange(DOWN) self.add(group) self.wait() Text: t2c t1 = Text("Hello, this is one sentence", font='굴림', size=0.5, stroke_width=1, t2c={'Hello': YELLOW, 'one': RED} ) t2 = Text("Google", font='Arial', ..
[013]Text: Transform eq = TexMobject("a^2", "+", "b^2", "=", "c^2") eq.save_state() self.add(eq) self.play( eq[0].become,TexMobject("3^2").move_to(eq[0]), eq[2].become,TexMobject("4^2").move_to(eq[2]), eq[4].become,TexMobject("5^2").move_to(eq[4]), run_time=2, ) self.wait() eq.restore() self.add() self.play( Transform(eq[0], TexMobject("3^2").move_to(eq[0])), Transform(eq[2], TexMobject("4^2").move_to(eq[2])), Trans..
[012]TextMobject.set_color/set_color_by_map Text Color: tex_to_color_map t1 = TexMobject( "P(A|B) = {P(A)P(B|A) \\over P(B)}", tex_to_color_map={ "A": YELLOW, "B": BLUE, }, ) self.add(t1) self.wait() Text Color: set_color_by_tex eq = TexMobject("x", "=", "L", "\\theta") eq.set_color_by_tex("\\theta", BLUE) self.add(eq) self.wait() Text Color: set_color_by_tex_to_color_map(1) all_words = VGroup( TextMobject("You have a\\\\", "hypothesis"),..
[011]Text/TextMobject Text Class str = ["사과","배", "대추", "감", "먹고 싶다"] text = VGroup(*[Text(s, font='J신영복 Regular') for s in str]) text.arrange(DOWN) self.add(text) self.wait() TextMobject Class (1) tex = TexMobject("a^2","+", "b^2","=","c^2") self.add(tex) self.wait() self.play( tex[0].set_color, RED, tex[2].set_color, RED, tex[4].become, TexMobject("d^2").move_to(tex[4]), # Transform(tex[4], TexMobject("d^2").move_t..