[Qt-qml] ScalingAnimation in QML

bea.lam at nokia.com bea.lam at nokia.com
Mon Aug 16 07:32:37 CEST 2010


Hi Bartosh,

> 
> So if I omit the transformOrigin in the PropertyChanges and write this
> 
> states: State {
> name: "rotated"
> PropertyChanges { target: rect;  rotation: 180 }
> }
>  
> transitions: Transition {
> SequentialAnimation {
> PropertyAction { target: rect; property: "transformOrigin"; value: Item.BottomRight }
> RotationAnimation { duration: 1000; direction: RotationAnimation.Counterclockwise }
>  }
> }
> 
> I am not sure I follow. If the state "rotated" is invoked, will the transform Origin change for this rotation? How does this work? In this context, does every rotation, regardless of state, have it's the transformOrigin  at BottomRight? Also, what if I want my transformOrigin to be coordinates and anchors, what can I do?


Yes, every rotation will use a transformOrigin at BottomRight. Actually, it doesn't make sense to use the PropertyAction like that; it'll be better to just change the transformOrigin inside the PropertyChanges so it can be reverted to its initial value in the default state.

To rotate at a specific point, you can change the x and y values in the PropertyChanges object, or use an AnchorChanges object to re-anchor the item. If you choose to move the x,y values then the item cannot be anchored in the first place, as anchors and x,y positioning can't be mixed together. 

Also, if you use AnchorChanges, the rectangle cannot be initially anchored to anchors.centerIn as currently the AnchorChanges object doesn't allow this property to be changed (this is a known bug).


Bea






More information about the Qt-qml mailing list