Apply rotation to an item multiple items
Solved
QML and Qt Quick
-
Hi ,
I want to apply 'rotation' property to an image in different angles to give different view everytime. So, how do I apply rotation 'n' times to an image.
transform: Rotation { origin.x: image.width/2; origin.y: image.height/2; angle: 20} transform: Rotation { origin.x: image.width/2; origin.y: image.height/2; angle: -30}
If i try multiple times to apply the property in qml, it gives error of "Duplicate property binding (M10)".
-
Timer{ onTriggered: theRotation.angle = Math.random()*360 interval: 1000//1s running: true repeat: true } Image{ id:img anchors.centerIn: parent height: sourceSize.height width: sourceSize.width source:"GUI/img/icon5.png" transform: Rotation{ id: theRotation origin.x: img.width/2; origin.y: img.height/2; angle: 20 Behavior on angle { NumberAnimation{ duration: 200 } } } }