beetlebug

ztk::clock

Reads the clock of the animations, and sets it in the headless backend.

Synopsis

ztk::clock get
ztk::clock set MS

Arguments

Name Type Default Meaning
get subcommand Gives the time of the animation clock in milliseconds.
set MS subcommand Sets the clock to MS milliseconds and asks for a new frame, so each animation moves to that time.

Return value

get gives an integer. set gives an empty string.

Errors

Error When
ztk::clock set needs the headless backend set on another backend.
expected integer but got "X" MS is not an integer.
wrong # args: should be "ztk::clock get|set ?ms?" Another subcommand, or a wrong count of words.

Platforms

Platform Works
Windows get only
macOS get only
Linux, Wayland get only
Linux, X11 get only
Web get only
iOS, Android get only
Headless Yes

Example

label .l -text Hello
pack .l
ztk::animate .l -background #2563eb -duration 400
ztk::clock set [expr {[ztk::clock get] + 200}]
update

See also