I want an animation to be painted when an element becomes visible (is should appear smoothly, not the whole at all)
I tried this
states: State
{
name
I had to modify Uga Buga's answer slightly to make it work, here's what I got:
Rectangle {
id: myRect
property bool stateVisible: true
...
states: [
State { when: myRect.stateVisible;
PropertyChanges { target: myRect; opacity: 1.0 }},
State { when: !myRect.stateVisible;
PropertyChanges { target: myRect; opacity: 0.0 }}
]
transitions: [ Transition { NumberAnimation { property: "opacity"; duration: 500}} ]
}
Please note that stateVisible is referenced through item id, it doesn't work without it on my system. Maybe some change in API caused this.
I also added square bracket in transitions
field as an array is required there (although QML syntax seems to allow spelling without brackets)