-
Notifications
You must be signed in to change notification settings - Fork 18
pyux.set_animation_handler
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)| Type | Description | |
|---|---|---|
func |
function |
A lua function that is invoked when the timer event occurs. nil will remove the handler. |
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 |
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!
This function is available in V26 and above.