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
Just for future references, here's my solution which takes care also of Vasco's warning. Basically I'm animating the visible
property of the component after the opacity has changed. It hurts seeing a NumberAnimation
on a boolean, but it's working:
states: [
State{
name: "Visible"
PropertyChanges{target: root; opacity: 1.0}
PropertyChanges{target: root; visible: true}
},
State{
name:"Invisible"
PropertyChanges{target: root; opacity: 0.0}
PropertyChanges{target: root; visible: false}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
SequentialAnimation{
NumberAnimation {
target: root
property: "opacity"
duration: 500
easing.type: Easing.InOutQuad
}
NumberAnimation {
target: root
property: "visible"
duration: 0
}
}
},
Transition {
from: "Invisible"
to: "Visible"
SequentialAnimation{
NumberAnimation {
target: root
property: "visible"
duration: 0
}
NumberAnimation {
target: root
property: "opacity"
duration: 500
easing.type: Easing.InOutQuad
}
}
}
]
This introduces also a transition when the component is vanishing.