Easing QML Type (Singleton)

Provides access to the easing enums and convenience API. More...

Import Statement: import QtQml
Since: Qt 6.11

Note: This type is a QML singleton. There is only one instance of this type in the QML engine.

Detailed Description

The Easing singleton provides access to the Easing enum, which is typically used by animations. It also provides the valueForProgress function as a convenience API:

    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)
        }
    }

The goal of this function is to offer a convenient way of easing a value along a given curve. For more advanced curves, use the easingCurve value type.

© 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.