# How to make a spinning wheel in SL (no JS need)

Feb 08, 2018

I got an email asking me if I can share how I build a spin wheel in Challenge#188. So I wrote this post to explain how I did it. You may like to see the demo first.

Ok, here is how I built it.

Create a spinnable wheel

First of all, I need a wheel so I inserted one from the content library. And to make it able to spin I duplicate and crop it to the spin area and then covert it to dial.

To make it spin smoothly and have multiple circles, I set the rotation equal to 3600 and the value from 0 to 9999.

Make it spins for a period of time after hitting a button

I like the wheel randomly spinning while a sound effect is playing after hitting a button. To control the wheel spinning or not spinning, I added one T/F variable (I call it “STOP”) to do the magic, the wheel will only spin when variable STOP is equal to False.

1. To make the wheel spinning for a period of time is to keep changing the value of dial in the period I want. So I created a little rectangle and make it able to quickly move up and down in loop during the period (Sound Effect playing).

• Create a loop: Move the rectangle up when motion down completes, move the rectangle down when the motion up completes on condition of variable STOP=False. Here, the loop will be ended when a trigger changes the variable STOP.
• Changing the dial value: add a random number to variable Dial when the animation completes up or down. So the dial value will keep changing while the looping exist.

2. Trigger a start and play a sound effect, there are four triggers to do so.

• Set variable STOP=False when clicking the BTN: this allows the wheel to spin because the object only moves on condition of variable STOP=False.
• Move the rectangle when clicking the BTN on condition of variable STOP=False.
• Set variable Dial=0 when clicking BTN to make sure it will turn when hit the BTN.

• Trigger the sound effect when variable Dial changes.

3. Stop spinning when media completes

Set default variable STOP = false, and then set a trigger to adjust variable STOP equal to True when media completes.

So the wheel spins and a sound effect plays when clicking the BTN by STEP 2, keep spinning while the sound effect playing by STEP 1 and stop spinning once the sound effect ends by STEP 3.

###### 34 Replies

Love it. I knew increasing the number of dial stops would increase the smoothness of the rotation but worried that it might also slow down the rotation too much.  Clearly, this is not the case and my concerns are gone!  I'm going to have to go back and add some stops to my spinner.

This is best spinning wheel example I have seen so far. Thanks for sharing.

How do you handle the prize selection with so many variables. It spins but I cant tell you what happens when you land on area 1 vs area 2

I am very new to storyline, and im really struggling to get this to work. Anyone able to offer any advice so that I can have 8 segments, landing on a different one each spin, and revealing the content that it lands on. I also cant seem to get my circle to stay neat in the middle it spins all over the page! Sorry, complete newbie.

Thanks,

Hi Rachel! Welcome to the E-Learning Heroes Community! I reached out to my team and Trina found this quick solution to centering the spinning wheel. It’s landing on a different part each time, so the random variable Joanne used, seems to be working great in your file too. I’m curious to see if any other community members have done anything similar to add custom content depending on each spin.

Thanks Sarah. That’s perfect. I did get it working in place but had to swap out my pie chart (with our brand colours for an online picture so wasn’t ideal. I’ll use this and get my pie chart centred.

ive got the game working like this... all 8 pieces of information are on a new layer. Each layer is linked to via the same freestyle drawn hotspot which is just underneath the triangle ticker at the top of the wheel. I’ve set buttons on each layer to hide layer and return to base layer. I’ve also set conditions on the hotspot so if button 1 on layer 1 is clicked then hotspot opens layer 2 and so on. So the spin is random but the information isn’t. It’s an ok fix but not exactly what I wanted as I can’t put words or images on the pie segments because I can’t force hotspots to attach and spin with the wheel. Or fix the wheel to land on a set segment regardless of spin.

any ideas?

Hi all,

I've updated a new version in the same demo link. Now you can reveal detail content by jumping to another slide according to which color you land. Since it is random, we can't force it to land different one each spin. But if you have been to the slide e.g. No.1, you can just spin again.

I would not suggest using this interaction in the course that need users to explore all. It might make learners frustrated if they can not land the one they want and after several repeating landing color, they might think it is just wasting time. Well, the spin wheel activity is fun but don't over use it.

Below is the updated .story file

Thank you. I love the character changing idea too.

Wow! Thank you for sharing an updated story file, Joanne! I also appreciate your explanation on how you made this. Impressive work! 😊

How are you using it?  Thanks

Hi Rachel,

Thanks for sharing your tribulations in recreating this brilliant wheel. I'm also wanting the wheel to spin randomly but to formalize what the learner sees, i.e., getting through six informational layers. Did your solution  ("I’ve also set conditions on the hotspot so if button 1 on layer 1 is clicked then hotspot opens layer 2 and so on.") end up working as intended?

Awesome - thanks for sharing this Joanne!

Hi - I added numbers 7-12 to the wheel and replaced/added the image file(s) duplicating slides 1-6. It works fine but needed it to see the extra numbers during the spin. Under trigger wizard I set the condition numbers for 1 to the first set and for 7 to the second set. (See example of 1 before and after). I also added trigger wizards for number 7-12 for the character. It runs, but regardless of which number it lands on the card and link are for number 12. Help! Faye

I updated it to handle 13 different choices.  It work fine if I limit the number to 6 but as soon as I add more than that it makes the result variable the last one in the list. Is there a limit of 6 assign variable statements or something?

Did anybody find a conclusion to be able to get the wheel number to match to the random number when the additional 6 are added. I am facing the same thing.

I deleted the random statement and then re-wrote it and now it work for whatever number.

J.R.(James)Thompson, MSE
eLearning Consultant
[signature

Hi, can you tell me how did you come to the decision which number to be added and what range will include the number on spinning wheel?

I decided I really didn't need the numbers on the wheel, just the spinning color wheel.  Then I didn't have to worry about coordinating numbers with choices, I just had the answer or question appear at the bottom.  Then is just a matter of setting my number of choices in the random statement.

Faye, I am having the exact same problem. I did the same steps, and mine looks just like the photos you posted. Did you ever find a solution?

I would like to see the file, but what I can suggest for now is for testing purposes add the variable on your screen so that you can see what number variable is on which outcome number. Hope this helps

You can try this too. I was able to make it without the music as in my case I wanted a background music that will play no matter whether the wheel is spinning or not

Can you tell me more?