A slight addition to the code.
We add a global var that will hold “pause” or “continue”
In the code we check what the global var is. If continue we carry on updating.
If pause we pause and the counter number is not updated but in the back ground the interval timer is still firing.
Set up for changing the global var simply uses Custom Behaviours. We use the names of the Custom Behaviours.
One name “pause” and one name “continue”
the Timeline actions trigger either. Both are linked to a Hype JS function that changes the global var value depending on which CB triggered.
Because the timer interval is always running the global var can be checked. depending on the status we will continue the update or pause the update.
This all may sound complicated but is ver simple. Look through this example.
Note the first Timeline action simple starts the counter function directly.
counterStartPause.hype.zip (14.1 KB)