En esta página

PathInterpolator QML Type

Especifica cómo crear animaciones manualmente a lo largo de una ruta. Más información...

Import Statement: import QtQuick

Propiedades

Descripción detallada

PathInterpolator proporciona información sobre « x », « y » y « angle » para un « progress » concreto a lo largo de una ruta.

En el siguiente ejemplo, animamos un rectángulo verde a lo largo de una ruta Bézier.

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 indica el ángulo de la tangente a 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 que se va a interpolar.

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

progress : real

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

El uso habitual de « PathInterpolator » consiste en establecer el progreso (a menudo mediante un « NumberAnimation ») y leer los valores correspondientes de x, y y ángulo (a menudo mediante enlaces a dichos valores).

El progreso oscila entre 0,0 y 1,0.

x : real [read-only]

y : real [read-only]

Estas propiedades indican la posición de la ruta 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.