Translation3DThe Translation3D item supports translation of items in 3D. More... Inherits QtObject Translation3D instantiates the C++ class QGraphicsTranslation3D This type was introduced in Qt 4.8. PropertiesDetailed Description3D items in QML are typically positioned directly as follows: Item3D {
mesh: Mesh { source: "chair.3ds" }
position: Qt.vector3d(0, 5, 10)
}
However, it can sometimes be useful to translate an object along a vector under the control of an animation. The Translate3D element can be used for this purpose. The following example translates the object along a straight-line path 5 units to the right of its original position, and then back again: Item3D {
mesh: Mesh { source: "chair.3ds" }
position: Qt.vector3d(0, 5, 10)
transform: [
Translation3D {
translate: Qt.vector3d(5, 0, 0)
SequentialAnimation on progress {
running: true
loops: Animation.Infinite
NumberAnimation { to : 1.0; duration: 300 }
NumberAnimation { to : 0.0; duration: 300 }
}
}
]
}
See also Rotation3D and Scale3D. Property DocumentationThe progress along the translation vector, from 0 to 1. The default value for this property is 1. This property can be used to perform animation along a translation vector by varying the progress between 0 and 1. Overshoot animations are also possible by setting the value to something outside this range. The translation to apply to incoming co-ordinates. The default value for this property is (0, 0, 0). |