SequentialAnimation{
PropertyAnimation{
properties: "width"
duration: 300
}
PropertyAnimation{
properties: "x"
duration: 500
}
Component.onCompleted: {
var idx = Math.ceil(Math.random()*2);
if(idx===0){
anim0.running = true
anim1.running = false
}
else {
anim1.running = true
anim0.running = false
}
console.log("haha");
}
}
SequentialAnimation{
id: anim0
running: false
NumberAnimation{
running: anim0.running
properties: "x"
to: 300
duration: 500
}
Component.onCompleted: console.log("anim0");
}
SequentialAnimation{
id: anim1
running: false
NumberAnimation{
running: anim1.running
properties: "x"
to: -300
duration: 500
}
Component.onCompleted: console.log("anim1");
}
首先忽略Component.onCompleted信号上的JavaScript。 带有id:anim1和anim0的SequencialAnimation虽然我已经将running属性设置为false但仍保持运行...
答案 0 :(得分:1)
将running
项的Animation
属性设置为false,不会阻止动画启动。如果它正在流行,它就会停止它。
如果您不希望在转换中启动动画,则不要将其置于转换中。
您始终可以在Animation
之外定义自定义Transition
项,并在需要时使用animationId.start()
功能触发它。
有关详细信息,请参阅documentation page。