Rotation3DThe Rotation3D item supports arbitrary rotation around an axis in 3D space. More... Inherits QtObject Rotation3D instantiates the C++ class QGraphicsRotation3D This type was introduced in Qt 4.8. PropertiesDetailed DescriptionFrequently a user will create and item in the 3d world and immediately wish to apply a rotation to that item before it is displayed, or, optionally, perform an animation on that rotation parameter based on user inputs, or other events. Such an rotation can easily be defined in QML using the following code: Item3D { id: helicoptor mesh: {source: "bellUH1.3ds"} effect: Effect {} cullFaces: "CullBackFaces" transform: [ Rotation3D { id: rotate1 angle: 5 axis: Qt.vector3d(1, 0, 0) }, Rotation3D { id: rotate2 angle: 5 axis: Qt.vector3d(0, 1, 0) }, Rotation3D { id: rotate3 angle: 45 axis: Qt.vector3d(0, 0, 1) } ] SequentialAnimation { NumberAnimation {target: rotate1; property: "angle"; to : 360.0; duration: 3000; easing:"easeOutQuad" } } } Notice here that we create a list of rotations for the transform property of the container item. By doing this we allow rotations around each of the axes individually in a manner which is conducive to animation and interaction. Each of the rotations has an axis property which is a QVector3D. This vector contains a value for each of the three components corresponding to x, y, and z. In the above example, we first rotate by 5 degrees about the x axis, then 5 degrees about the y axis, and finally by 45 degrees about the z axis. By giving each rotation a unique id users can then refer to these rotations in the QML source in order to perform rotational animations. See also Translation3D and Scale3D. Property DocumentationThe angle to rotate around the axis, in degrees anti-clockwise. The default value for this property is 0. The axis to rotate around. The default value for this property is (0, 0, 1); i.e. the z-axis. The origin about which to rotate. The default value for this property is (0, 0, 0). |