Timer
The Timer widget is a time display widget that counts down from a set time, or counts elapsed time up, and shows the result on screen.
Use it for time limits, stopwatches, event end notices, and similar cases.
Definition and role
The Timer widget draws the time as text in the format you set, such as mm:ss. Countdown mode counts down from a given time to zero, and count-up mode counts up from zero. Start, stop, and reset the timer from a script, and run an expiry action when a countdown reaches 00:00.
- Category: Contents
- Default mode: countdown (
countDown) - Default display format:
mm:ss - Default countdown time: 60 seconds (60000ms)
- Default update interval: 1 second (1000ms)
Features
| Feature | Description |
|---|---|
| Countdown / count-up | Counts down from the set time or up from zero, depending on the mode. |
| Time format display | Displays the time as hh:mm:ss, mm:ss, ss, or a format that includes milliseconds. |
| Script control | Start, stop, and reset the timer and check whether it is running, all from a script. |
| Expiry event | Runs the action connected to onExpired when a countdown reaches 00:00. |
How to use
- Open the Contents category in the left widget palette.
- Drag and drop the Timer item onto the canvas.
- In the properties panel on the right, set the mode (
timerType) and the display format (timeFormat). - In countdown mode, set the time limit with
countdownTimeMs. - If you need to, connect an action to
onExpiredto run on expiry, and callstart(),stop(), andreset()from a script.
Properties
| Property | Description | Default | Value / Type |
|---|---|---|---|
timerType | Timer mode (countdown or count-up) | countDown | countDown, countUp |
timeFormat | Time display format | mmss | hhmmss, mmss, ss, hhmmssMs, mmssMs, ssMs |
countdownTimeMs | Countdown start time, in milliseconds | 60000 (60 seconds) | Number (ms) |
updateIntervalMs | Screen update interval, in milliseconds | 1000 (1 second) | Number (ms) |
style | Text style, such as color and size | Default style (not set) | Text style |
Notes and tips
onExpired fires in countdown mode only. Count-up mode keeps increasing with no upper bound, so it has no expiry event.
In edit (design) mode the timer does not actually run — it only previews the start value. Time passes once you call start() on the running screen. Also, if updateIntervalMs is 0 or less, the timer runs on the default 1-second (1000ms) interval.
Learn more
For the full set of Widget Control (Property, Method, and Event) you can use to script this widget, see Timer Widget Control.