Auf dieser Seite

Easing QML Type (Singleton)

Bietet Zugriff auf die Easing-Enumerationen und die Komfort-API. Mehr...

Import Statement: import QtQml
Since: Qt 6.11

Hinweis: Dieser Typ ist ein QML-Singleton. Es gibt nur eine Instanz dieses Typs in der QML-Engine.

Ausführliche Beschreibung

Das „Easing“-Singleton bietet Zugriff auf die Enumeration „ Easing “, die typischerweise von „ animations “ verwendet wird. Es stellt außerdem die Funktion „ valueForProgress “ als Komfort-API bereit:

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

Das Ziel dieser Funktion ist es, eine bequeme Möglichkeit zu bieten, einen Wert entlang einer vorgegebenen Kurve zu glätten. Für komplexere Kurven verwenden Sie den Werttyp „ easingCurve “.

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