En esta página

easingCurve QML Value Type

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

Since: Qt 6.11

Descripción detallada

El tipo easingCurve es un valor con atributos que definen un easing curve:

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

Resulta útil cuando se realizan animaciones personalizadas con FrameAnimation, por ejemplo, o en cualquier caso de uso que requiera facilitar un valor a lo largo de una curva determinada.

Para crear un valor easingCurve, importe QtQml (o QtQuick) a un espacio de nombres:

import QtQml as QtQml

A continuación, cree una instancia del mismo con new:

        readonly property easingCurve easingCurve: Easing.InQuart

El siguiente ejemplo es similar al descrito por 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 easingCurve: 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)
        }
    }

También es posible crear easingCurve mediante la sintaxis de tipo de valor estructurado:

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

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

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

Véase también Tipos de valor 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.