Toggle buttons on click to play different timelines/symbols


(Leo) #1

buttons: A, B C,

buttons toggled on click, possible combinations:

A+A
A+B
A+C

B+A
B+B
B+C

C+A
C+B
C+C

all combinations lead to TIMELINE 1 being played
with the exception of A+C which will play TIMELINE 2
and C+B which will play TIMELINE 3

any ideas how to implement this ?


#2

I think there are three things you need to do.

First, you need to

  1. Setup the state of all your buttons
  2. You need to detect button combinations whenever a button has been clicked
  3. …and then you also need to run a function when a button is clicked that toggles the state of the button.

Below is an example:

//setup your buttons
var ButtonA = false;
var ButtonB = false;
var ButtonC = false;
var ButtonD = false;

// Toggle Button A to 'on'. Run this 'on mouse click' for your button: 
ButtonA = true;

// Detect a combination. 
// This should run whenever a button has been clicked
if (ButtonA = true && ButtonB = true){
  
  hypeDocument.startTimelineNamed('Timeline 1');
  
}

// all you other combinations go here, or they can be inserted 
// within the initial 'if' statement above. 
if (ButtonA = true && ButtonC = true){
  
  hypeDocument.startTimelineNamed('Timeline 2');
  
}

(Leo) #4

Thanks Daniel, I have added an else statement as well to move the AE cloud timeline to the start if a different combination is entered other than (ButtonA = true && ButtonC = true) but it doesn’t seem to be responding

Diagram 0.12 copy.hype.zip (401.7 KB)