QML animations visible property changes

marmistrz picture marmistrz · Sep 8, 2012 · Viewed 17.2k times · Source

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: "iconOff"
    when: iconOnSwitch.checked == false
    PropertyChanges { target: selectIconRow; visible: false }
}

transitions: Transition
{
    reversible: true
    from: ""
    to: "iconOff"
    PropertyAnimation
    {
        properties: "x,y,visible"
        easing.type: Easing.InOutQuad
        from: selectIconRow
        property: "visible"
    }
}

But the selectIconRow still appears immediately

How can I use such an animation?

Answer

sergk picture sergk · Sep 9, 2012

Because it's boolean, visible property cannot be animated. Perhaps opacity could do the trick.