Sur cette page

PathInterpolator QML Type

Spécifie comment animer manuellement le long d'un chemin. Plus d'informations...

Import Statement: import QtQuick

Propriétés

Description détaillée

PathInterpolator fournit les informations x, y, et angle pour un progress particulier le long d'un chemin.

Dans l'exemple suivant, nous animons un rectangle vert le long d'un chemin de 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
    }
}

Documentation sur les propriétés

angle : real [read-only]

Cette propriété indique l'angle de la tangente de la trajectoire à progress.

Les angles sont indiqués dans le sens des aiguilles d'une montre, avec zéro degré à la position 3 heures.

path : Path

Cette propriété contient le chemin à interpoler.

Pour plus d'informations sur la définition d'un chemin, voir la documentation de Path.

progress : real

Cette propriété contient la progression actuelle le long du chemin.

L'utilisation typique de PathInterpolator consiste à définir la progression (souvent via NumberAnimation) et à lire les valeurs correspondantes pour x, y et l'angle (souvent via des liaisons avec ces valeurs).

La progression est comprise entre 0,0 et 1,0.

x : real [read-only]

y : real [read-only]

Ces propriétés déterminent la position du chemin à l'adresse 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.