PathInterpolator QML Type
Legt fest, wie man eine Animation manuell entlang eines Pfades ausführt. Mehr...
| Import Statement: | import QtQuick |
Eigenschaften
Ausführliche Beschreibung
PathInterpolator liefert Informationen zu „ x “, „ y “ und „ angle “ für eine bestimmte „ progress “ entlang eines Pfades.
Im folgenden Beispiel animieren wir ein grünes Rechteck entlang eines Bézier-Pfades.
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
}
}Dokumentation zu den Eigenschaften
angle : real [read-only]
Diese Eigenschaft gibt den Winkel der Tangente an der Position „ progress “ an.
Winkel werden im Uhrzeigersinn angegeben, wobei 0 Grad der 3-Uhr-Position entspricht.
path : Path
Diese Eigenschaft enthält den zu interpolierenden Pfad.
Weitere Informationen zum Definieren eines Pfades finden Sie in der Dokumentation unter „ Path “.
progress : real
Diese Eigenschaft enthält den aktuellen Fortschritt entlang des Pfades.
Typischerweise wird „ PathInterpolator “ verwendet, um den Fortschritt festzulegen (häufig über „ NumberAnimation “) und die entsprechenden Werte für x, y und den Winkel auszulesen (häufig über Bindungen zu diesen Werten).
Der Fortschritt reicht von 0,0 bis 1,0.
Diese Eigenschaften geben die Position des Pfades unter progress an.
© 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.