UniformAnimator QML Type

Le type UniformAnimator anime un uniforme d'un ShaderEffect. Plus...

Import Statement: import QtQuick
Inherits:

Animator

Propriétés

Description détaillée

Animator sont différents des types d'animation normaux. Lorsqu'on utilise un Animator, l'animation peut être exécutée dans le fil de rendu et la valeur de la propriété sautera à la fin lorsque l'animation sera terminée.

La valeur de la propriété QML définissant l'uniforme est mise à jour une fois l'animation terminée.

L'extrait suivant montre comment utiliser un UniformAnimator avec un élément 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"
}

Il est également possible d'utiliser le mot-clé on pour lier l'UniformAnimator directement à un uniforme d'une instance ShaderEffect.

ShaderEffect {
    width: 50
    height: 50
    property variant t;
    UniformAnimator on t {
        from: 0
        to: 1
        duration: 1000
    }
    fragmentShader: "qrc:shader.frag.qsb"
}

Voir également ShaderEffect et ShaderEffectSource.

Propriété Documentation

uniform : string

Cette propriété contient le nom de l'uniforme à animer.

La valeur de l'uniforme doit correspondre à une propriété de la cible ShaderEffect et doit être un uniforme de type float dans le fragment ou le 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.