En esta página

PathInterpolator QML Type

Especifica cómo animar manualmente a lo largo de una trayectoria. Más...

Import Statement: import QtQuick

Propiedades

Descripción detallada

PathInterpolator proporciona x, y, y angle información para un progress particular a lo largo de una trayectoria.

En el siguiente ejemplo, animamos un rectángulo verde a lo largo de una trayectoria bezier.

import QtQuick

Rectangle {
    width: 400
    height: 400

    PathInterpolator {
        id: motionPath

        path: Path {
            startX: 0; startY: 0

            PathCubic {
                x: 350; y: 350

                control1X: 350; control1Y: 0
                control2X: 0; control2Y: 350
            }
        }

        NumberAnimation on progress { from: 0; to: 1; duration: 2000 }
    }

    Rectangle {
        width: 50; height: 50
        color: "green"

        //bind our attributes to follow the path as progress changes
        x: motionPath.x
        y: motionPath.y
        rotation: motionPath.angle
    }
}

Documentación de propiedades

angle : real [read-only]

Esta propiedad mantiene el ángulo de la tangente de la trayectoria en progress.

Los ángulos se indican en el sentido de las agujas del reloj, con cero grados en la posición de las 3 en punto.

path : Path

Esta propiedad contiene la ruta a interpolar.

Para más información sobre cómo definir una ruta, consulte la documentación de Path.

progress : real

Esta propiedad contiene el progreso actual a lo largo de la ruta.

El uso típico de PathInterpolator es establecer el progreso (a menudo a través de NumberAnimation), y leer los valores correspondientes para x, y, y ángulo (a menudo a través de enlaces a estos valores).

El progreso oscila entre 0.0 y 1.0.

x : real [read-only]

y : real [read-only]

Estas propiedades mantienen la posición de la trayectoria en progress.

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