easingCurve QML Value Type
Value that represents an easing curve. More...
Since: | Qt 6.11 |
Detailed Description
The easingCurve
type is a value with attributes that define an easing curve:
enumeration type
real amplitude
real overshoot
real period
list<real> bezierCurve
It is useful when doing custom animations with FrameAnimation, for example, or in any use case that requires easing a value along a given curve.
To create an easingCurve
value, import QtQml
(or QtQuick
) into a namespace:
import QtQml as QtQml
Then, create an instance of it with new
:
readonly property easingCurve easingCurve: Easing.InQuart
The following example is similar to the one described by the documentation of Easing:
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) } }
It's also possible to create easingCurve
via structured value type syntax:
readonly property easingCurve inElasticCurve: ({ type: Easing.InElastic, amplitude: 4, period: 3 })
When integrating with C++, note that any QEasingCurve value passed into QML from C++ is automatically converted into an easingCurve
value. When an easingCurve
value is passed to C++, it is automatically converted into a QEasingCurve value.
A default-constructed easingCurve
is equal to new QtQml.easingCurve(QtQml.Easing.Linear)
.
See also QML Value Types.
© 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.