UniformAnimator QML Type
Il tipo `UniformAnimator` anima un'uniforme di un ` ShaderEffect`. Per saperne di più...
| Import Statement: | import QtQuick |
| Inherits: |
Proprietà
- uniform : string
Descrizione dettagliata
Animator I tipi sono diversi dai normali tipi di animazione. Quando si utilizza un Animator, l'animazione può essere eseguita nel thread di rendering e il valore della proprietà salterà alla fine una volta completata l'animazione.
Il valore della proprietà QML che definisce l’uniform viene aggiornato al termine dell’animazione.
Il frammento di codice seguente mostra come utilizzare un UniformAnimator insieme a un elemento ` 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"
}È inoltre possibile utilizzare la parola chiave ` on ` per collegare direttamente l’`UniformAnimator` a un’uniforme di un’istanza di ` ShaderEffect `.
ShaderEffect {
width: 50
height: 50
property variant t;
UniformAnimator on t {
from: 0
to: 1
duration: 1000
}
fragmentShader: "qrc:shader.frag.qsb"
}Nota: i tipidi animatore non offrono alcun vantaggio quando si utilizza un ciclo di rendering non multithread.
Nota: si raccomanda che le applicazioni prendano in considerazione progetti basati su principi multithread e asincroni, piuttosto che affidarsi agli Animator per mostrare contenuti animati mentre si eseguono operazioni costose e bloccanti sul thread principale (GUI). Invece di operazioni lunghe e bloccanti, è preferibile utilizzare WorkerScript e asynchronous image loading in QML, nonché thread di lavoro, algoritmi paralleli Qt Concurrente le coroutine in C++, mantenendo così l’intera applicazione e l’interfaccia utente sempre reattive.
Vedi anche ShaderEffect e ShaderEffectSource.
Documentazione sulle proprietà
uniform : string
Questa proprietà contiene il nome dell'uniforme da animare.
Il valore dell'uniform deve corrispondere sia a una proprietà dell'ShaderEffect e di destinazione, sia a un'uniform di tipo float nello shader di frammento o di vertice.
© 2026 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.