Skip to content

pyux.set_animation_handler

fabian-flassig edited this page Jul 8, 2026 · 2 revisions

Sets up a handler to create fluid animations in 3D space. Use pyux.start_animation to actually start the animation

pyux.set_animation_handler(handler)

Parameters

Type Description
func function A lua function that is invoked when the timer event occurs. nil will remove the handler.

Callback

The parameters to the handler function are as follows:

function on_timer_handler(seconds)
Type Description
seconds number Elapsed time since pyux.start_animation in seconds

Note:

Use pyux.start_animation to start the animation.

The elapsed time parameter seconds is actually an estimate of the time, when the next animation frame will be visible to the user. Calling os.clock will produce different timing information that is less suited for smooth animations.

The animation callback allows a restricted subset of API functions only. The PYTHA library and (mathematical) utility functions are supported, while the pyui, pyux, pyio libraries are prohibited!

If user interface elements need updating, a less resource intensive mechanism, must be set up in parallel. A timer could, for example, be used to update a dialog 5 times a second to show the latest values, while the animation proceeds at full speed.

In case of lua errors, the animation handler function will silently fail!

Version Support:

Minimum PYTHA Version: V26

See also

pyux, start_animation, stop_animation, set_timer_handler

Clone this wiki locally