在原始条件和 SequentialAnimation 之间切换
不知道如何表达我的问题。我的代码片段只是为了说明我想要在更大的代码库中实现的目标。我有一个“原始条件”,可以改变图像的不透明度,该图像独立于顺序动画。在 SequentialAnimation 完成更改“originalCondition”绑定回不透明度的图像的不透明度后,我想要实现的目标。 不确定绑定是否是描述它的适当方式
由于某种原因,这种情况不会发生,我不确定为什么或如何做到这一点。
Item {
id: root
property bool activatedLetter: false
Button {
text: "Click me"
onClicked: root.activatedLetter = true
}
Image {
id: headerBackgroundImage
visible: true
opacity: originalCondition
}
SequentialAnimation {
running: root.activatedLetter
onStopped: {
if(root.activatedLetter) {
headerBackgroundImage.visible = true
}
headerBackgroundImage.opacity = 1
root.activatedLetter = false
}
PauseAnimation {
duration: 750
}
NumberAnimation {
target: headerBackgroundImage
property: "opacity"
from: 1
to: 0
duration: 1000
}
NumberAnimation {
target: headerBackgroundImage
property: "visible"
from: 1
to:0
duration: 1000
}
}
}
Not sure how to express my question. My snippet code is just to illustrate what I want to achieve in a much bigger code base. I have an "originalCondition" that changes the opacity of an image which is independent of the SequentialAnimation. What I want to achieve after the SequentialAnimation has completed changing the opacity for the Image that the "originalCondition" binds back to the opacity. Not sure if bind is the appropriate way to describe it
For some reason, this does not occur and I am not sure why or how to do it.
Item {
id: root
property bool activatedLetter: false
Button {
text: "Click me"
onClicked: root.activatedLetter = true
}
Image {
id: headerBackgroundImage
visible: true
opacity: originalCondition
}
SequentialAnimation {
running: root.activatedLetter
onStopped: {
if(root.activatedLetter) {
headerBackgroundImage.visible = true
}
headerBackgroundImage.opacity = 1
root.activatedLetter = false
}
PauseAnimation {
duration: 750
}
NumberAnimation {
target: headerBackgroundImage
property: "opacity"
from: 1
to: 0
duration: 1000
}
NumberAnimation {
target: headerBackgroundImage
property: "visible"
from: 1
to:0
duration: 1000
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在你的 onStopped 中,而不是这个:
尝试这个:
In your onStopped, instead of this:
try this: