In questa pagina

Easing QML Type (Singleton)

Fornisce l'accesso alle enumerazioni relative alle animazioni e all'API di comodità. Altro...

Import Statement: import QtQml
Since: Qt 6.11

Nota: questo tipo è un singleton QML. Nel motore QML esiste una sola istanza di questo tipo.

Descrizione dettagliata

Il singleton Easing fornisce l'accesso all'enumerazione ` Easing `, tipicamente utilizzata da ` animations`. Fornisce inoltre la funzione ` valueForProgress ` come API di comodità:

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

Lo scopo di questa funzione è offrire un modo pratico per applicare un effetto di accelerazione a un valore lungo una curva specificata. Per curve più complesse, utilizzare il tipo di valore ` 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.