Trigger when a variable increases or decreases?

Apr 13, 2017

Hi Heroes!

I've seen hundreds of examples for how to create a trigger that increases or decreases a variable by a set value (e.g. "add 1"), as well as examples of triggering an event when a variable changes to a specific value (e.g. "if variable = 1). But can you trigger an event when a variable increases or decreases by a specific amount? For example, "Change the state of Object_A to Hidden when Variable_X increases by 1"

My end goal is to create an invisible slider with a 'relative' start point. My inspiration is those websites where you can drag left and right to spin an object like a car, computer or camera. In these interactions, it doesn't matter where the user clicks on the slide to start, only how far they drag the slider around. For example:  

I'm thinking a trigger based on the change in a variable rather than the value of that variable would be a nice way to achieve this effect. Is such a trigger possible in Storyline?

Thanks in advance for any insights!

3 Replies
Walt Hamilton

Be careful; SL will not allow you to mix AND and OR, so your trigger has to be one or the other. With careful use, you can create a bunch of triggers that accomplish AND/OR.

To answer your question - no, SL does not have a native trigger like that. But bear in mind, sliders always are tied to a variable, which takes care of the relative start point. At any time, the slide will always be at the point of the variable. So if you change a state when the variable changes, the slider will go along with it.

Here's a sample:


The little square in the center is the slide. The slider is long enough and the thumb large enough that the thumb can never go so far it doesn't cover the slide. So wherever you click, you can move the slider. Shapes can be used to cover the parts of the slide you don't want to be clickable. The thumb is set to only about 90% transparency, so you can see it. With the thumb set to 100% transparency, you can place it above the spinning object, and it will intercept the clicks without compromising the view of the object. Triggers and shapes will do the rest, and the more shapes, the smoother the animation. Sure, it's a lot of work, but smooth animation has always been very labor intensive. It's either very hard, or very expensive.

In the video, you can see the center box of the thumb, which won't disappear even at 100% transparency, so you will need a picture to fill the thumb. I set the slider to start at 0 and go to 10, with steps of .1, and put on a watcher so you can see it change.

To me, a slider seems easier than the triggers and math, but if you are sold on that method, you can probably use javascript to calculate the amount of change in a variable, and when you reach threshold amounts have it change another variable that changes the states.

Good Luck.

Amy Lewis

Walt, thank you for the in-depth response and video! I think you've hit on the most feasible solution for a 'relative' slider. I didn't think about making one of the slider thumbs so large that it covers the whole slide (rather than just the slider track) - this is a great idea that will allow the user to click nearly anywhere on the slide without the slider 'jumping' to a new value when they click somewhere unexpected.

Now that the functionality is figured out, I just need to work on creating enough states for the shape to keep it from appearing too choppy.

Thanks again!

This discussion is closed. You can start a new discussion or contact Articulate Support.