In questa pagina

PathInterpolator QML Type

Specifica come creare manualmente un'animazione lungo un percorso. Maggiori informazioni...

Import Statement: import QtQuick

Proprietà

Descrizione dettagliata

PathInterpolator fornisce le informazioni relative a x, y e angle per un determinato progress lungo un percorso.

Nell'esempio seguente, animiamo un rettangolo verde lungo un percorso di 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
    }
}

Documentazione delle proprietà

angle : real [read-only]

Questa proprietà indica l'angolo della tangente al percorso nel punto progress.

Gli angoli sono indicati in senso orario, con lo zero gradi nella posizione delle ore 3.

path : Path

Questa proprietà contiene il percorso da interpolare.

Per ulteriori informazioni sulla definizione di un percorso, consultare la documentazione relativa a Path.

progress : real

Questa proprietà contiene lo stato di avanzamento corrente lungo il percorso.

Un utilizzo tipico di ` PathInterpolator ` consiste nell'impostare l'avanzamento (spesso tramite un ` NumberAnimation`) e leggere i valori corrispondenti per x, y e l'angolo (spesso tramite collegamenti a questi valori).

L'avanzamento varia da 0,0 a 1,0.

x : real [read-only]

y : real [read-only]

Queste proprietà indicano la posizione del percorso all'indirizzo 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.