Dice

Dice preview
remixableManimCE3Dprobabilitycombinatoricsturntable

manim/dice.py

"""Dice: two dice tumbling, their sums stacking into a triangle.

Two dice sit in front of a row of eleven bars, one for each sum from 2 to
12. The first few rolls play at full length, the dice tumbling and landing
and their sum's bar growing by one, so the rule is plain. Then the rolls
speed up, the dice spin without stopping and the bars climb through three
hundred and sixty rolls, until the dice land once more and the bars stand in
the triangle, six ways to make a 7 and one way each to make a 2 or a 12.

Each die is a real cube with its pips on its faces, turned by a rotation, so
the face that lands up is the face that was rolled. Every roll is drawn from
one seed up front; the last is fixed at 3 and 4, so the still, which is the
loop's last frame, shows the dice on a 7 beside the tallest bar.

The loop is a oneshot: counts only grow.

The full Manim source and the rendered video come with a plan.