Jonathan_Hill
7 months agoSuper Hero
FREE: Perpetual Dial
Spinning out of my work on E-Learning Challenge #453, here's my early entry for Challenge #454, Using Variables.
Try it for yourself here.
This demo uses Number, Text and True/False variables to trigger events based on the position of the dial.
But as you can see, this dial spins in both directions - seemingly forever* - overcoming one of the limitations of this interactive object.
I've achieved this by incorporating the following Javascript, which reports the position of the dial as 0-359° despite the dial having a rotation of 0-9360°.
// Function to calculate the position within the range of 0-359 function calculatePosition(dial) { // Calculate the position within the range of 0-359 var position = (dial % 360 + 360) % 360; return position; } // Get the value of the Storyline variable Dial and calculate Position var Dial = player.GetVar("Dial"); // Assuming "Dial" is the name of your Storyline variable var Position = calculatePosition(Dial); // Set the Storyline variable "Position" to the adjusted value player.SetVar("Position", Position); // Assuming "Position" is the name of your Storyline variable |
Download the file to see how it works, and please let me know if you have any questions.
* Try spinning it continuously in one direction - it'll take you a while to reach the end, but see what happens 😃