This sample code is here:
import QtQuick 2.0
Item {
width: 200; height: 200
Rectangle {
width: 100; height: 100
anchors.centerIn: parent
color: "#00FF00"
Rectangle {
color: "#FF0000"
width: 10; height: 10
anchors.top: parent.top
anchors.right: parent.right
}
}
}
Will produce this result:

Now I want to apply a 3D rotation from the center of this green rectangle. First, I want to rotate X -45 degrees (bow), then Y -60 degrees (turning left).
I used the following C ++ code cut with GLM to help me calculate the axis and angle:
glm::mat4 rotationMatrix = glm::eulerAngleXY(glm::radians(-45.0f), glm::radians(-60.0f));
glm::quat quaternion = glm::toQuat(rotationMatrix);
glm::vec3 axis = glm::axis(quaternion);
double angle = glm::degrees(glm::angle(quaternion));
The result of this small C ++ program gave me an axis {-0.552483, -0.770076, 0.318976}and an angle 73.7201. So I updated my sample code:
import QtQuick 2.0
Item {
width: 200; height: 200
Rectangle {
width: 100; height: 100
anchors.centerIn: parent
color: "#00FF00"
Rectangle {
color: "#FF0000"
width: 10; height: 10
anchors.top: parent.top
anchors.right: parent.right
}
transform: Rotation {
id: rot
origin.x: 50; origin.y: 50
axis: Qt.vector3d(-0.552483, -0.770076, 0.318976)
angle: 73.7201
}
}
}
Which gives me exactly what I wanted to see:

So far so good. Now comes the hard part. How do I revive this? For example, if I want to go from {45.0, 60.0, 0} to {45.0, 60.0, 90.0}. In other words, I want to animate here

here

I turned on this rotation of the target here
glm::mat4 rotationMatrix = glm::eulerAngleXYZ(glm::radians(-45.0f), glm::radians(-60.0f), glm::radians(90.0f);
glm::quat quaternion = glm::toQuat(rotationMatrix);
glm::vec3 axis = glm::axis(quaternion);
double angle = glm::degrees(glm::angle(quaternion));
{-0.621515, -0.102255, 0.7767} 129.007
,
ParallelAnimation {
running: true
Vector3dAnimation {
target: rot
property: "axis"
from: Qt.vector3d(-0.552483, -0.770076, 0.318976)
to: Qt.vector3d(-0.621515, -0.102255, 0.7767)
duration: 4000
}
NumberAnimation {
target: rot;
property: "angle";
from: 73.7201; to: 129.007;
duration: 4000;
}
}
"" . , , , , . , , , , . , , , 45 90 , , , , 180 45 , , .
?
------------------- -------------------
: , , , .
, 3- 3
transform: [
Rotation {
id: zRot
origin.x: 50; origin.y: 50;
angle: 0
},
Rotation {
id: xRot
origin.x: 50; origin.y: 50;
angle: -45
axis { x: 1; y: 0; z: 0 }
},
Rotation {
id: yRot
origin.x: 50; origin.y: 50;
angle: -60
axis { x: 0; y: 1; z: 0 }
}
]
:

.