Sur cette page

PathInterpolator QML Type

Indique comment créer manuellement une animation le long d'un tracé. En savoir plus...

Import Statement: import QtQuick

Propriétés

Description détaillée

PathInterpolator fournit des informations sur l'x, l'y et l'angle d'un élément progress donné le long d'un chemin.

Dans l'exemple suivant, nous animons un rectangle vert le long d'un tracé 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 des propriétés

angle : real [read-only]

Cette propriété représente l'angle de la tangente à la trajectoire au point progress.

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

path : Path

Cette propriété contient le chemin à interpoler.

Pour plus d'informations sur la définition d'un chemin, consultez la documentation relative à l'Path.

progress : real

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

PathInterpolator est généralement utilisé pour définir la progression (souvent via un NumberAnimation) et lire les valeurs correspondantes pour x, y et l'angle (souvent via des liaisons vers ces valeurs).

La progression varie entre 0,0 et 1,0.

x : real [read-only]

y : real [read-only]

Ces propriétés indiquent la position du chemin d'accès à 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.