easingCurve QML Value Type
Wert, der eine Entspannungskurve darstellt. Mehr...
| Since: | Qt 6.11 |
Detaillierte Beschreibung
Der Typ easingCurve ist ein Wert mit Attributen, die eine easing curve definieren:
enumeration typereal amplitudereal overshootreal periodlist<real> bezierCurve
Er ist z. B. nützlich bei benutzerdefinierten Animationen mit FrameAnimation oder in jedem anderen Anwendungsfall, in dem ein Wert entlang einer bestimmten Kurve gelockert werden muss.
Um einen easingCurve Wert zu erstellen, importieren Sie QtQml (oder QtQuick) in einen Namespace:
import QtQml as QtQml
Erzeugen Sie dann mit new eine Instanz davon:
readonly property easingCurve easingCurve: Easing.InQuart
Das folgende Beispiel ähnelt dem, das in der Dokumentation von Easing beschrieben ist:
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. readonly property easingCurve easingCurve: Easing.InQuart 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 = inQuartCurve.valueForProgress(elapsed / duration) } }
Es ist auch möglich, easingCurve über die Syntax des strukturierten Werttyps zu erstellen:
readonly property easingCurve inElasticCurve: ({ type: Easing.InElastic, amplitude: 4, period: 3 })
Bei der Integration mit C++ ist zu beachten, dass jeder QEasingCurve Wert, der von C++ an QML übergeben wird, automatisch in einen easingCurve Wert umgewandelt wird. Wenn ein easingCurve Wert an C++ übergeben wird, wird er automatisch in einen QEasingCurve Wert umgewandelt.
Ein standardmäßig konstruierter easingCurve ist gleich new QtQml.easingCurve(QtQml.Easing.Linear).
Siehe auch QML-Wertetypen.
© 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.