QML 动画可见属性更改 [英] QML animations visible property changes

查看:21
本文介绍了QML 动画可见属性更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在元素变得可见时绘制动画(应该是平滑的,而不是整体)

I want an animation to be painted when an element becomes visible (is should appear smoothly, not the whole at all)

我试过了

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"
    }
}

但是 selectIconRow 仍然会立即出现

But the selectIconRow still appears immediately

如何使用这样的动画?

推荐答案

因为它是布尔值,所以 visible 属性不能动画.也许 opacity 可以解决问题.

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

这篇关于QML 动画可见属性更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆