UniformAnimator QML Type
UniformAnimator 类型可为ShaderEffect 的制服制作动画... 更多...
Import Statement: | import QtQuick |
Inherits: |
属性
- uniform : string
详细说明
Animator 类型不同于普通的动画类型。使用 Animator 时,动画可在呈现线程中运行,动画完成后,属性值将跳转到末尾。
定义制服的 QML 属性值会在动画结束后更新。
下面的代码段展示了如何将 UniformAnimator 与ShaderEffect 项目结合使用。
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" }
也可以使用on
关键字将 UniformAnimator 直接与ShaderEffect 实例的制服绑定。
ShaderEffect { width: 50 height: 50 property variant t; UniformAnimator on t { from: 0 to: 1 duration: 1000 } fragmentShader: "qrc:shader.frag.qsb" }
另请参阅 ShaderEffect 和ShaderEffectSource 。
属性文档
uniform : string |
此属性包含要制作动画的制服名称。
制服的值必须与目标ShaderEffect 上的属性相对应,并且必须是片段或顶点着色器中float
类型的制服。
© 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.