我有一张页面,其中4张卡片放在彼此的顶部。我想添加快捷方式来访问每张卡而不点击“下一步”按钮。我有一个动画来让卡片滑动。 我想在一次点击中多次调用这个动画但是当我调用animation.start()时,它似乎只执行一个。 这是我的代码:
MyShortcut{
onClicked:{
for(var i=0; i<3; i++){
var actualCardSelected = actualCard()
console.log("clique clique, card selected ", actualCardSelected)
// while(actualCardSelected !== 1 ){
if(datePickerContainer.x != pageGeneralSettings.width){
}else if(timePickerContainer.x != pageGeneralSettings.width){
previousCard = datePickerContainer
margin = 0
animateGoLeft.start()
}else if(globalConfigContainer.x != pageGeneralSettings.width){
if(currentTimeDate.checked){
previousCard = datePickerContainer
timePickerContainer.x = (pageGeneralSettings.width - maxCardWidth)/2 - 10
margin = 0
}else{
previousCard = timePickerContainer
margin = 10
}
animateGoLeft.start()
}else if(visualConditionsContainer.x != pageGeneralSettings.width){
previousCard = globalConfigContainer
buttonRight.text="Next"
margin = 20
animateGoLeft.start()
}
}
//}
}
}
PropertyAnimation{
id:animateGoRight
target:selectedCard
loops:1
properties:"x"
to:pageGeneralSettings.width
easing.type: Easing.InQuint;
duration:500
}
PropertyAnimation{
id:animateGoLeft
target:previousCard
loops:1
properties:"x"
to:(pageGeneralSettings.width-dp(320) - maxCardWidth)/2 - margin
easing.type: Easing.OutQuint;
duration:500
}
function actualCard(){
var result
if(datePickerContainer.x != pageGeneralSettings.width){
result = 1
}else if(timePickerContainer.x != pageGeneralSettings.width){
result = 2
}else if(globalConfigContainer.x != pageGeneralSettings.width){
result = 3
}else if(visualConditionsContainer.x != pageGeneralSettings.width){
result = 4
}else{
result = 0
}
return result
}