easingCurve QML Value Type
Wert, der eine Abklingkurve darstellt. Mehr...
| Import Statement: | import QtQml |
| Since: | Qt 6.11 |
Ausführliche Beschreibung
Der Typ „ easingCurve “ ist ein Wert mit Attributen, die eine Beschleunigungs- und Abbremskurve ( easing curve) definieren:
enumeration typereal amplitudereal overshootreal periodlist<real> bezierCurve
Er ist nützlich, wenn Sie beispielsweise benutzerdefinierte Animationen mit „ FrameAnimation “ erstellen oder in jedem Anwendungsfall, in dem ein Wert entlang einer vorgegebenen Kurve animiert werden soll.
Um einen „ easingCurve “-Wert zu erstellen, weisen Sie einen Easing-Typ zu:
readonly property easingCurve inQuartCurve: Easing.InQuartDas folgende Beispiel ähnelt dem in der Dokumentation zu „ Easing “ beschriebenen:
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 inQuartCurve: 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)
}
}Da „ easingCurve “ ein „ structured value “-Typ ist, kann er mit einem JavaScript-Objekt instanziiert werden:
readonly property easingCurve inElasticCurve: ({
type: Easing.InElastic,
amplitude: 4,
period: 3
})Bei der Integration mit C++ ist zu beachten, dass jeder aus C++ an QML übergebene „ QEasingCurve “-Wert automatisch in einen „ easingCurve “-Wert konvertiert wird. Wenn ein „ easingCurve “-Wert an C++ übergeben wird, wird er automatisch in einen „ QEasingCurve “-Wert konvertiert.
Ein standardmäßig konstruiertes ` easingCurve ` entspricht einem ` new QtQml.easingCurve(QtQml.Easing.Linear)`.
Siehe auch QML-Werttypen.
© 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.