I have noticed that many people struggle to work out how to make a toggle button that uses a single Timeline.
Many get tripped up by putting a Pause timeline at the beginning of the timeline when wanting to use reverse timeline.
The animations either don’t start, take two clicks to start or just repeat …
Here is an Example of how to do it simply and with only one Timeline.
Note I do not use start Timeline anywhere… especially in the Buttons Actions. This is another mistake that people fall into when trying to make a toggle like this.
I am still using this method today. Thank you for sharing. Does anyone know why a simple reverse timeline is not possible? Or does anyone have a script to solve this?
The behavior would ideally be to use an on mouse up release event to trigger a timeline to play and then use a second mouse up event on the same button to reverse the timeline that just played. That would be a very simple toggle construct. I am happy to use the solution but it seems complex.
@MarkHunte’s example was timeline based, which has no conditional structure built into it. So a wee bit of JavaScript will give You a simple conditional evaluation. Most of the code is generated by Hype’s Timeline API that is tucked inside a simple conditional (if/else) construct:
e.g. if (current time in timeline is “0”) play timeline forward, else play timeline reverse.
Though this thread is a year old, this tip came in handy for me now. Thanks Jim.
On a separate, but related note: I think Hype could use a condition builder. Having one could do away with many small and simple conditional needs that seem too involving (code wise) for most designers without major frustration, and dependency on forum members that are code savvy. Hopefully this is already recognized, and is slated for near future release.
Thank you for sharing this technique, it's very efficient.
Just ask you a question:
I’m using this technique for more than one button. When a single button is clicked, it change color.
I wish that when one of these buttons is clicked, the previously clicked button will disable.
I don't understand how can i make this without java... or do I need it?