I would like to know how can I create a dice animation displaying random values for my manim project.
I looked over the manim documentation and 3blue1brown github but I'm not really into coding and seems very confusing for me. Thanks :s
I would like to know how can I create a dice animation displaying random values for my manim project.
I looked over the manim documentation and 3blue1brown github but I'm not really into coding and seems very confusing for me. Thanks :s
Manim is all about programming your animations using Python. There is no short-cut I believe, however, Python is considered to be quite an easy language to learn.
class dice(Scene):
def construct(self):
faces = VGroup(
VGroup(
Square(side_length=2),
),
VGroup(
Square(side_length=2),
Dot([0,0,0], radius=0.2),
),
VGroup(
Square(side_length=2),
Dot([-0.67,-0.67,0], radius=0.2),
Dot([+0.67,+0.67,0], radius=0.2),
),
VGroup(
Square(side_length=2),
Dot([-0.67,-0.67,0], radius=0.2),
Dot([0,0,0], radius=0.2),
Dot([+0.67,+0.67,0], radius=0.2),
),
VGroup(
Square(side_length=2),
Dot([-0.67,-0.67,0], radius=0.2),
Dot([+0.67,+0.67,0], radius=0.2),
Dot([-0.67,+0.67,0], radius=0.2),
Dot([+0.67,-0.67,0], radius=0.2),
),
VGroup(
Square(side_length=2),
Dot([-0.67,-0.67,0], radius=0.2),
Dot([+0.67,+0.67,0], radius=0.2),
Dot([0,0,0], radius=0.2),
Dot([-0.67,+0.67,0], radius=0.2),
Dot([+0.67,-0.67,0], radius=0.2),
),
VGroup(
Square(side_length=2),
Dot([-0.67,-0.67,0], radius=0.2),
Dot([+0.67,+0.67,0], radius=0.2),
Dot([-0.67,+0.67,0], radius=0.2),
Dot([+0.67,-0.67,0], radius=0.2),
Dot([+0.67,0,0], radius=0.2),
Dot([-0.67,0,0], radius=0.2),
),
)
for i in range(10):
self.wait()
num = np.random.random_integers(low = 1, high = 6)
self.play(SpinInFromNothing(faces[num]))
self.wait()
self.play(FadeOut(faces[num]))