- Qt 6.11
- Qt Qml
- QML Types
- easingCurve
- Qt 6.11.2 Reference Documentation

# 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, assign an easing type:

             readonly property easingCurve inQuartCurve: 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 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)
             }
         }

As `easingCurve` is a structured value type, it can be constructed with a JavaScript object:

         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.