from manim import *
from manim import DARK_GREY, LIGHT_GREY, BLUE, PURPLE
config.background_color = WHITE

class sim(Scene):
    def construct(self):
        # erste stufe
        self.wait(2)
        line1 = Line([-2, 0, 0], [0,1.25,0])
        line2 = Line([-2, 0, 0], [0,-1.25,0])
        line1.set_stroke(BLACK, width=1.5)
        line2.set_stroke(BLACK, width=1.5)
        dot1 = Dot(point=[0,1.25,0], color='BLACK')
        dot2 = Dot(point=[0,-1.25,0], color='GREY')
        self.play(FadeIn(line1,line2))
        self.play(FadeIn(dot1,dot2))
        self.wait(2)

        # zweite stufe
        line3 = Line([0.1,1.25,0], [1.5,2,0])
        line4 = Line([0.1,1.25,0], [1.5,1.25,0])
        line5 = Line([0.1,1.25,0], [1.5,0.5,0])
        line3.set_stroke(BLACK, width=1.5)
        line4.set_stroke(BLACK, width=1.5)
        line5.set_stroke(BLACK, width=1.5)
        line6 = Line([0.1,-1.25,0], [1.5,-0.5,0])
        line7 = Line([0.1,-1.25,0], [1.5,-1.25,0])
        line8 = Line([0.1,-1.25,0], [1.5,-2,0])
        line6.set_stroke(BLACK, width=1.5)
        line7.set_stroke(BLACK, width=1.5)
        line8.set_stroke(BLACK, width=1.5)
        dot3 = Dot(point=[1.5,2,0], color='BLUE')
        dot4 = Dot(point=[1.5,1.25,0], color='RED')
        dot5 = Dot(point=[1.5,0.5,0], color='GREEN')
        dot6 = Dot(point=[1.5,-0.5,0], color='BLUE')
        dot7 = Dot(point=[1.5,-1.25,0], color='RED')
        dot8 = Dot(point=[1.5,-2,0], color='GREEN')
        self.play(FadeIn(line3,line4,line5,line6,line7,line8))
        self.play(FadeIn(dot3,dot4,dot5,dot6,dot7,dot8))
        self.wait(2)

        # dritte stufe
        line9 = Line([1.6,2,0], [3,2.15,0])
        line10 = Line([1.6,2,0], [3,1.85,0])
        line11 = Line([1.6,1.25,0], [3,1.4,0])
        line12 = Line([1.6,1.25,0], [3,1.1,0])
        line9.set_stroke(BLACK, width=1.5)
        line10.set_stroke(BLACK, width=1.5)
        line11.set_stroke(BLACK, width=1.5)
        line12.set_stroke(BLACK, width=1.5)
        line13 = Line([1.6,0.5,0], [3,0.65,0])
        line14 = Line([1.6,0.5,0], [3,0.35,0])
        line15 = Line([1.6,-0.5,0], [3,-0.35,0])
        line16 = Line([1.6,-0.5,0], [3,-0.65,0])
        line13.set_stroke(BLACK, width=1.5)
        line14.set_stroke(BLACK, width=1.5)
        line15.set_stroke(BLACK, width=1.5)
        line16.set_stroke(BLACK, width=1.5)
        line17 = Line([1.6,-1.25,0], [3,-1.1,0])
        line18 = Line([1.6,-1.25,0], [3,-1.4,0])
        line19 = Line([1.6,-2,0], [3,-1.85,0])
        line20 = Line([1.6,-2,0], [3,-2.15,0])
        line17.set_stroke(BLACK, width=1.5)
        line18.set_stroke(BLACK, width=1.5)
        line19.set_stroke(BLACK, width=1.5)
        line20.set_stroke(BLACK, width=1.5)
        dot9 = Dot(point=[3,2.15,0], color='#FC6255')
        dot10 = Dot(point=[3,1.85,0], color='#FC6201')
        dot11 = Dot(point=[3,1.4,0], color='#FC6255')
        dot12 = Dot(point=[3,1.1,0], color='#FC6201')
        dot13 = Dot(point=[3,0.65,0], color='#FC6255')
        dot14 = Dot(point=[3,0.35,0], color='#FC6201')
        dot15 = Dot(point=[3,-0.35,0], color='#FC6255')
        dot16 = Dot(point=[3,-0.65,0], color='#FC6201')
        dot17 = Dot(point=[3,-1.1,0], color='#FC6255')
        dot18 = Dot(point=[3,-1.4,0], color='#FC6201')
        dot19 = Dot(point=[3,-1.85,0], color='#FC6255')
        dot20 = Dot(point=[3,-2.15,0], color='#FC6201')
        self.play(FadeIn(line9,line10,line11,line12,line13,line14,line15,line16,line17,line18,line19,line20))
        self.play(FadeIn(dot9,dot10,dot11,dot12,dot13,dot14,dot15,dot16,dot17,dot18,dot19,dot20))
        self.wait(2.5)

        tex1 = MathTex(r"2", color=BLACK).scale(1)
        tex2 = MathTex(r"3", color=BLACK).scale(1)
        tex3 = MathTex(r"2", color=BLACK).scale(1)
        tex4 = MathTex(r"12", color=BLACK).scale(1)
        tex5 = MathTex(r"\cdot", color=BLACK).scale(1)
        tex6 = MathTex(r"\cdot", color=BLACK).scale(1)
        tex7 = MathTex(r"=", color=BLACK).scale(1)
        tex1.move_to([0,-3,0])
        tex2.move_to([1.5,-3,0])
        tex3.move_to([3,-3,0])
        tex4.move_to([4,-3,0])
        tex5.move_to([0.75,-3,0])
        tex6.move_to([2.25,-3,0])
        tex7.move_to([3.5,-3,0])
        self.play(FadeIn(tex1))
        self.play(FadeIn(tex5))
        self.play(FadeIn(tex2))
        self.play(FadeIn(tex6))
        self.play(FadeIn(tex3))
        self.play(FadeIn(tex7))
        self.play(FadeIn(tex4))
        self.wait(4)


         # vierte  stufe
        line21 = Line([3,2.15,0], [4,3.15,0])
        line22 = Line([3,2.15,0], [4,2.95,0])
        line23 = Line([3,2.15,0], [4,2.75,0])
        line24 = Line([3,2.15,0], [4,2.55,0])
        line25 = Line([3,2.15,0], [4,2.35,0])
        line26 = Line([3,2.15,0], [4,2.15,0])
        line27 = Line([3,2.15,0], [4,1.95,0])
        line28 = Line([3,2.15,0], [4,1.75,0])
        line29 = Line([3,2.15,0], [4,1.55,0])
        line30 = Line([3,2.15,0], [4,1.35,0])
        line21.set_stroke(BLACK, width=1.5)
        line22.set_stroke(BLACK, width=1.5)
        line23.set_stroke(BLACK, width=1.5)
        line24.set_stroke(BLACK, width=1.5)
        line25.set_stroke(BLACK, width=1.5)
        line26.set_stroke(BLACK, width=1.5)
        line27.set_stroke(BLACK, width=1.5)
        line28.set_stroke(BLACK, width=1.5)
        line29.set_stroke(BLACK, width=1.5)
        line30.set_stroke(BLACK, width=1.5)
        dot21 = Dot(point=[4,3.15,0], color='#FC6656')
        dot22 = Dot(point=[4,2.95,0], color='#FC6756')
        dot23 = Dot(point=[4,2.75,0], color='#FC6856')
        dot24 = Dot(point=[4,2.55,0], color='#FC6956')
        dot25 = Dot(point=[4,2.35,0], color='#FC6156')
        dot26 = Dot(point=[4,2.15,0], color='#FC6256')
        dot27 = Dot(point=[4,1.95,0], color='#FC6356')
        dot28 = Dot(point=[4,1.75,0], color='#FC6456')
        dot29 = Dot(point=[4,1.55,0], color='#FC6556')
        dot30 = Dot(point=[4,1.35,0], color='#FC1156')
        self.play(FadeIn(line21,line22,line23,line24,line25,line26,line27,line28,line29,line30))
        self.play(FadeIn(dot21,dot22,dot23,dot24,dot25,dot26,dot27,dot28,dot29,dot30))
        self.wait(1)
        texDots = MathTex(r"...", color=BLACK).scale(1)
        texDots.move_to([4.5,0,0])
        self.play(FadeIn(texDots))
        self.wait(7)

        self.play(FadeOut(line21,line22,line23,line24,line25,line26,line27,line28,line29,line30,dot21,dot22,dot23,dot24,dot25,dot26,dot27,dot28,dot29,dot30))
        self.play(FadeOut(texDots))
        self.wait(10)    
        self.play(Indicate(dot1,color=BLUE),Indicate(dot2,color=BLUE))
        self.wait(0.5)
        self.play(Indicate(dot3,color=BLUE),Indicate(dot4,color=BLUE),Indicate(dot5,color=BLUE),Indicate(dot6,color=BLUE),Indicate(dot7,color=BLUE),Indicate(dot8,color=BLUE))
        self.wait(0.5)
        self.play(Indicate(dot9,color=BLUE),Indicate(dot10,color=BLUE),Indicate(dot11,color=BLUE),Indicate(dot12,color=BLUE),Indicate(dot13,color=BLUE),Indicate(dot14,color=BLUE),Indicate(dot15,color=BLUE),Indicate(dot16,color=BLUE),Indicate(dot17,color=BLUE),Indicate(dot18,color=BLUE),Indicate(dot19,color=BLUE),Indicate(dot20,color=BLUE))
        #tex3= MathTex(r"\text{C}", color=BLACK).scale(1)
        #tex4 = MathTex(r"\text{D}", color=BLACK).scale(1)
        #tex3.move_to([0.25,1.25,0])
        #tex4.move_to([0.25,0.25,0])

        #tex5= MathTex(r"\text{E}", color=BLACK).scale(1)
        #tex6 = MathTex(r"\text{F}", color=BLACK).scale(1)
        #tex5.move_to([0.25,-0.25,0])
        #tex6.move_to([0.25,-1.25,0])

        #tex7= MathTex(r"\mathbb{P}(A)", color=BLACK).scale(0.8)
        #tex8= MathTex(r"\mathbb{P}(B)", color=BLACK).scale(0.8)
        #tex7.move_to([-2.25,1,0])
        #tex8.move_to([-2.25,-1,0])


        #self.play(Create(line))
        #self.play(Create(line2))
        #self.play(FadeIn(tex1))
        #self.play(FadeIn(tex2))
        #self.play(Create(line3))
        #self.play(Create(line4))
        #self.play(Create(line5))
        #self.play(Create(line6))
        #self.play(FadeIn(tex3,tex4))
        #self.play(FadeIn(tex5,tex6))
        #self.play(FadeIn(tex7,tex8))
