Triggering a second action with the same button

Hey there
I’m trying to do something really simple but I can’t for the life of me figure out how to do it,
The action is pretty simple.
Clicking a button expands an area and clicking it the second time collapses the area.
It’s the second part that baffles me. I cannot think of a way to add the collapsing part to the same object.

I tried to do it first with timelines but I cannot assign two things with the same action on one button.
So then I tried having two scenes.
With a click the timeline of the second scene is triggered and with a click of the button on that second scene I go back to the first scene. This way though I cannot make the collapsing animation work.

I’m obviously missing something here!
Any ideas/pointers?

Thanks in advance for your answer.

Try this to get some ideas (21.8 KB)

1 Like

I knew I was missing something!
The timeline way was exactly what I was looking for.
Thank you very much!

You’re welcome. Could you mark it as solved? Little box next to the chain, flag and pencil.

Hello DBear,

I have used a different scenes layout to make my example worked. However, I would like to use timelines or javascript, if possible, to produce the same result. I have examined your ideas here with interest. I have tried to adapt them to this attached file but went not too far.
The buttons part1, part2 and part3 are triggering the correct action at the zoom1 level when the scene is loaded. My goal is to trigger two other actions from the same buttons given the zoom level selected.
So, I created three sets (buttons_zoom1, buttons_zoom2, buttons_zoom3) of duplicated buttons with their corresponding action on mouse click. This example works fine except that, whatever the zoom level selected (2 or 3) the parts are still showing up at zoom level 1. I cannot find the correct procedure to make the parts buttons appear or hide properly along the timeline zoom.

Many thanks for your help. (266.1 KB)

It’s because even though the buttons for the parts had 0% opacity, they were still clickable. If you “hide” them with the same timeline actions then you will get (I assume) your desired result :wink:

Opacity is just that, but visibility will display the element in the DOM or not depending on visibility: hidden / visible (271.4 KB)

1 Like

welcome back :slight_smile:



1 Like

Thank you so much.
Happy Holidays.

1 Like