Re: How to change transform origin in NumberAnimation?
Hi everyone,
Thread topic pretty much sums it up : ).
I want to have a different origin than the default one for my transformation.
Here is my code:
Code:
ParallelAnimation {
id: testAnimationDuPath1
running: false
loops: 1
NumberAnimation { target: itemPrincipal; property: "rotation"; to: 360; duration: 1500 }
NumberAnimation { target: shell; property: "rotation"; to: 360; duration: 1500 }
}
What arguments should I use and where should I put them?
Of maybe I need to use another function like RotationAnimation?
If so I have have the same question, I could not find a specific answer as to changing the rotation origin.
Yours,
--Jay
Added after 1 40 minutes:
I managed to change the origin of rotation by adding this into the concerned item:
Code:
transform: Rotation {
id: shellRotation
}
SequentialAnimation {
id: shellRotationAnimation
running: false
PropertyAction { target: shellRotation; property: "origin.x"; value: 408 }
PropertyAction { target: shellRotation; property: "origin.y"; value: 220 }
NumberAnimation { target: shellRotation; property: "angle"; to: 360; easing.type: Easing.OutQuad; duration: 500 }
}
Never know. Might help people : )
--Jay
Re: How to change transform origin in NumberAnimation?
You can set a Rotation transformation on the item's transform property and then animate its angle property.
http://doc.qt.io/qt-5/qml-qtquick-rotation.html
Edit: if the origin doesn't need to change, you can already specify it at the Rotation element
Cheers,
_