我有一个不透明度为90%的灰色矩形,我正在尝试使用动画来更改这种不透明度。我尝试使用OpacityAnimator,但正如文档所述,在动画结束后,Item :: opacity的值会更新。
这不是我所期望的,我想降低动画过程中的不透明度,而不是在2秒后立即将其从90更改为0。
那就是我所拥有的:
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("title")
Rectangle{
width: parent.width
height: parent.height
opacity: 90
color: "gray"
id: recLoading
Text {
id: txtLoading
text: qsTr("Loading")
font.bold: true
}
OpacityAnimator on opacity{
from: 90
to:0
duration:2000
target: parent
running:true
}
}
}
尝试将不透明度值更改为0到1之间的值,即
...
Rectangle{
width: parent.width
height: parent.height
opacity: 0.9
...
OpacityAnimator on opacity{
from: 0.9
to: 0.0
duration:2000
target: parent
running:true
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句