En esta página

easingCurve QML Value Type

Valor que representa una curva de atenuación. Más información...

Import Statement: import QtQml
Since: Qt 6.11

Descripción detallada

El tipo « easingCurve » es un valor con atributos que definen una curva de aceleración ( easing curve):

  • enumeration type
  • real amplitude
  • real overshoot
  • real period
  • list<real> bezierCurve

Resulta útil, por ejemplo, al crear animaciones personalizadas con FrameAnimation, o en cualquier caso de uso que requiera aplicar una aceleración a un valor a lo largo de una curva determinada.

Para crear un valor ` easingCurve `, asigna un tipo de suavizado:

        readonly property easingCurve inQuartCurve: Easing.InQuart

El siguiente ejemplo es similar al descrito en la documentación de 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)
        }
    }

Dado que ` easingCurve ` es un tipo ` structured value `, se puede construir con un objeto JavaScript:

    readonly property easingCurve inElasticCurve: ({
        type: Easing.InElastic,
        amplitude: 4,
        period: 3
    })

Al integrar con C++, ten en cuenta que cualquier valor de ` QEasingCurve ` pasado a QML desde C++ se convierte automáticamente en un valor de ` easingCurve `. Cuando se pasa un valor de ` easingCurve ` a C++, se convierte automáticamente en un valor de ` QEasingCurve `.

Un easingCurve construido por defecto es igual a un new QtQml.easingCurve(QtQml.Easing.Linear).

Véase también Tipos de valores de QML.

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