Timer Blocks
Last updated
Last updated
You can add a Timer to your app from the Blocks tab of your Thunkable project. Under the App Features header, click the ⊕ icon next to Timers to add a Timer to your app.
The Timer's properties are initially set when you add a Timer to your project.
You will see the Timers you have added to your app underneath the Timers section of your blocks. To edit the properties after the fact or delete a timer, click the gear icon next to the Timer's name in the left panel of the Blocks tab.
Set something to happen when the Timer fires.
Starts the Timer.
Stops the Timer.
If Count Up
is false
, returns remaining time from the Timer's interval in seconds.
If Count Up
is true
, returns elapsed time from the Timer's interval in seconds.
If Count Up
is false
, returns remaining time from the Timer's interval in milliseconds.
If Count Up
is true
, returns elapsed time from the Timer's interval in milliseconds.
Set interval of Timer in milliseconds.
Returns interval of Timer in milliseconds
Set whether Count Up is enabled for this Timer.
Returns true
or false
value for whether Count Up is enabled for this Timer.
If Loops = true
, the timer will reset itself after it fires. If your interval is 10 seconds, the Timer will fire every 10 seconds.
If Loops = false
, the timer will finish its current interval if it is in the middle of one, and will no longer fire. If your interval is 10s, the timer will finish its current 10 second interval, fire, and then stop.
Returns true
or false
value for whether Loops is enabled for this Timer.
Set whether the Timer is enabled.
Returns true
or false
value for whether this Timer is enabled.
Start by creating a variable and set its value to 0 (this will keep track of the time).
Add a timer to your project.
Add a button that will start and pause the stopwatch.
Inside the "when button click" block, add a condition: if the timer is running, pause the stopwatch; if it's not, start it.
Set the timer interval to 1 second/1000 Milliseconds and enable looping so it keeps running.
Add a label to display the elapsed time in seconds.
Use the "when timer fires" block to increase the variable by 1 every second and update the label with the new value.
Start by creating a variable and set its value to 5000 to count five minutes.
Add a timer to your project.
Add a button that will start and pause the Timer.
Inside the "when button click" block, add a condition: if the timer is running, pause the Timer; if it's not, start it.
Set the timer interval to 1 second/1000 Milliseconds and enable looping so it keeps running.
Add a label to display the running time in seconds.
Use the "when timer fires" block to decrease the variable by 1 every second and update the label with the new value if the variable is greater than zero.
Property | Description | Data Type |
---|---|---|
Interval
How regularly the Timer fires, in seconds or milliseconds
Number
Count Up
Toggle whether the Timer's time blocks return the current time as counted up from 0 or counted down from the interval duration
True/False
Loops
Toggle whether the Timer will start again once it has fired
True/False
Enabled
Toggle whether the Timer is active in your app
True/False