Beispiel #1
0
    def construct(self):
        circle = Circle(color=nq_colors["purple"])
        circle.set_fill(nq_colors["purple"], opacity=0.5)

        square = Square(color=nq_colors["orange"])
        square.flip(RIGHT)
        square.rotate(-3 * 2 * math.pi / 8)

        self.play(ShowCreation(square))
        self.play(Transform(square, circle))
        self.play(FadeOut(square))
Beispiel #2
0
    def generate_points(self):
        faces = np.array(
            get_faces_of_cubie(self.dimensions,
                               (self.position[0], self.position[1],
                                self.position[2]))).tolist()
        i = 0
        for vect in OUT, DOWN, LEFT, IN, UP, RIGHT:
            face = Square(side_length=2, shade_in_3d=True,
                          stroke_width=3)  #(**self.dict)
            if vect.tolist() in faces:
                face.set_fill(self.colors[i], 1)
            else:
                face.set_fill(BLACK, 1)

            face.flip()
            face.shift(2 * OUT / 2.0)
            face.apply_matrix(z_to_vector(vect))

            self.faces[tuple(vect)] = face
            self.add(face)
            i += 1