Easing QML Type (Singleton)
Permet d'accéder aux énumérations d'accélération et à l'API de commodité. En savoir plus…
| Import Statement: | import QtQml |
| Since: | Qt 6.11 |
Remarque : ce type est un singleton QML. Il n'existe qu'une seule instance de ce type dans le moteur QML.
Description détaillée
Le singleton Easing donne accès à l'énumération « Easing », généralement utilisée par animations. Il fournit également la fonction « valueForProgress » en tant qu'API pratique :
Rectangle {
id: rect
width: 100
height: 100
anchors.centerIn: parent
color: "red"
opacity: 0
}
FrameAnimation {
id: frameAnimation
running: true
property real elapsed // In seconds.
readonly property real duration: 2 // Two seconds.
onTriggered: {
elapsed += frameTime
// Loop once we reach the duration.
if (elapsed > duration)
elapsed = 0
// Increase the opacity from 0 slowly at first, then quickly.
rect.opacity = Easing.valueForProgress(Easing.InQuart, elapsed / duration)
}
}L'objectif de cette fonction est d'offrir un moyen pratique d'appliquer une accélération à une valeur le long d'une courbe donnée. Pour des courbes plus complexes, utilisez le type de valeur ` easingCurve `.
© 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.