【发布时间】:2016-08-20 18:54:44
【问题描述】:
我有一个不透明度为 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
}
}
}
【问题讨论】: