How To Make A Random Rolling Dice Animation in PowerPoint Using 3D Objects & VBA
There are five animations available for 3D Models in PowerPoint. We shall be using the Jump & Turn animation to fake the rolling dice animation. We shall be clubbing the Entrance: Zoom animation along with it to make it look more realistic. Using a trigger animation, both the animations will occur only when the Spin Shape is clicked.
Using VBA Code, we can randomize the X, Y and Z values of the 3D Object. So, on click of the Spin Shape, the following takes place:
- The coordinates of the 3D Object are randomised such that a dice face from 1 to 6 is shown.
- The trigger animation occurs and shows the rolling dice animation with the randomised coordinates of the 3D Object.
How To Make Who Wants To Be A Millionaire Quiz Game Show in PowerPoint
Let's learn how to create a PowerPoint Dice rolling animation. It is completely free and you can download the PowerPoint Dice Template that can be used in classrooms and PowerPoint Games.
✅ 3D Animated Rolling Dice Animation
✅ Randomise Dice Position using VBA
Softwares:
Features:
Here is how we create an Interactive PowerPoint Quiz Game:
Step 1: Insert 3D Dice Model
Step 2: Add Spin Button
Step 3: Rolling Dice Animation
Step 4: VBA Code to Randomize
SpinDice
. The dice will be randomised when the VBA Macro is run, which would occur when the 'Spin Button' is clicked.
Dim Dice As Model3DFormat, xax As Integer, yax As Integer, zax As Integer
Sub SpinDice()
For i = 1 To 2 'change to '1 To 1' if only once dice
Set Dice = ActivePresentation.SlideShowWindow.View.Slide.Shapes("dice" & i).Model3D
Randomize
R = Int((6 * Rnd) + 1)
If R = 1 Then p1
If R = 2 Then p2
If R = 3 Then p3
If R = 4 Then s1
If R = 5 Then s2
If R = 6 Then s3
AdjustCoords
Next i
End Sub
Sub AdjustCoords()
Dice.RotationX = xax
Dice.RotationY = yax
Dice.RotationZ = zax
End Sub
Sub p1()
xax = Int((30 * Rnd) + 73)
yax = Int((10 * Rnd) + 349)
zax = Int((50 * Rnd) + 64)
End Sub
Sub p2()
xax = Int((30 * Rnd) + 250)
yax = Int((10 * Rnd) + 349)
zax = Int((50 * Rnd) + 270)
End Sub
Sub p3()
xax = Int((30 * Rnd) + 160)
yax = Int((10 * Rnd) + 349)
zax = Int((50 * Rnd) + 170)
End Sub
Sub s1()
xax = Int((30 * Rnd) + 190)
yax = Int((20 * Rnd) + 280)
zax = Int((50 * Rnd) + 314)
End Sub
Sub s2()
xax = Int((30 * Rnd) + 130)
yax = Int((20 * Rnd) + 70)
zax = Int((50 * Rnd) + 150)
End Sub
Sub s3()
xax = Int((30 * Rnd) + 0)
yax = Int((20 * Rnd) + 0)
zax = Int((20 * Rnd) + 0)
End Sub
How to make Random Dice in PowerPoint?
If you do not have a version of PowerPoint that supports 3D Models, you can insert the six faces of the dice as an image and overlap them on top of each other. Name the images as ‘a1’ to ‘a6’ and ‘b1’ to ‘b6’ in case you have two dice. The dice face images can be downloaded from here or you can get the entire PowerPoint Template for free too!
Using the following VBA Code, we will hide all the faces and then show any one random face. You can delete the highlighted lines in case you have only one dice.
Sub ShuffleDice()
Randomize
r1 = Int(Rnd * 6) + 1 'generate random numbers
r2 = Int(Rnd * 6) + 1
For i = 1 To 6 'hide all 12 images
ActivePresentation.SlideShowWindow.View.Slide.Shapes("a" & i).Visible = msoFalse
ActivePresentation.SlideShowWindow.View.Slide.Shapes("b" & i).Visible = msoFalse
Next i
'show any 2 images
ActivePresentation.SlideShowWindow.View.Slide.Shapes("a" & r1).Visible = msoCTrue
ActivePresentation.SlideShowWindow.View.Slide.Shapes("b" & r2).Visible = msoCTrue
End Sub
Using Microsoft PowerPoint, we can create a lot of fascinating and interactive games and solutions for classrooms. Here is a video tutorial on making a random dice generator simulation:
🎯 In this tutorial
Download Random Dice (Rolling Animation) PowerPoint Template For Free
🤝 Free Template
Randomised 3D Dice + Spin Animation
🌞 Free Template
2D Random Dice Simulator in PowerPoint