UniformAnimator QML Type
The UniformAnimator type animates a uniform of a ShaderEffect. More...
| Import Statement: | import QtQuick |
| Inherits: |
Properties
- uniform : string
Detailed Description
Animator types are different from normal Animation types. When using an Animator, the animation can be run in the render thread and the property value will jump to the end when the animation is complete.
The value of the QML property defining the uniform is updated after the animation has finished.
The following snippet shows how to use a UniformAnimator together with a ShaderEffect item.
ShaderEffect { id: shader width: 50 height: 50 property variant t; UniformAnimator { target: shader uniform: "t" from: 0 to: 1 duration: 1000 running: true } fragmentShader: "qrc:shader.frag.qsb" }
It is also possible to use the on keyword to tie the UniformAnimator directly to a uniform of a ShaderEffect instance.
ShaderEffect { width: 50 height: 50 property variant t; UniformAnimator on t { from: 0 to: 1 duration: 1000 } fragmentShader: "qrc:shader.frag.qsb" }
Note: Animator types have no benefit when a non-threaded render loop is used.
Note: It is recommended that applications consider designs based on multi-threaded, asynchronous principles, rather than relying on Animators to show animated content while doing expensive, blocking work on the main (GUI) thread. Instead of long, blocking operations, prefer using WorkerScript and asynchronous image loading in QML, and worker threads, parallel algorithms, Qt Concurrent, and coroutines in C++, thus keeping the entire application and UI responsive all the time.
See also ShaderEffect and ShaderEffectSource.
Property Documentation
uniform : string
This property holds the name of the uniform to animate.
The value of the uniform must correspond to both a property on the target ShaderEffect and must be a uniform of type float in the fragment or vertex shader.
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.