Hello there,
first sorry my english, but I meet some problem need your help...
UI animation flow:(like Loop)
functionA make animation-a -> click butttonA -> make butttonA do animation-A -> on animation-A end event -> call a functionC
animation-a: make butttonA appear,add end event
animation-A: make butttonA disappear,add end event
functionC: call functionA again
but in actually situation,first time(first Loop), when I click button, it will trigger animation-a end event first,then do animation-A, then trigger animation-A end event.
secend time(second Loop), when I click button, it will trigger animation-a end event twice! then do animation-A twice, then trigger animation-A end event twice...
third time, when I click button, it will trigger animation-a end event triple! then do animation-A triple, then trigger animation-A end event triple... and so on..
I couldn't separate animation in the same item object...I don't know why..
below is my codes:
function showUI2(){
if(scene2_finished){
scene2_finished = false;
item3
.animate({
opacity:0
},0)
.animate({
translate: [0, -220, 0],
opacity:0.8
}, 800, 'ease-in-quat')
.animate({
scale: [0.3,0.3, 0]
}, 500, 'ease-in-out-back');
backBtn_item
.animate({
opacity:0
},0)
.animate({
translate: [0, 30, 0],
opacity:1
}, 1300, 'ease-in-quat');
backBtn.addEventListener('click',function(e){
backBtn_clickflag = true;
e.preventDefault();
item3
.animate({
scale: [-.3, -.3, 0],
translate: [0, 220, 0],
opacity:0
}, 600, 'ease-in-out-back');
backBtn_item
.animate({
translate: [0, -30, 0],
opacity:0
}, 600, 'ease-in-out-back')
.on('end', after_end());
},false);
}
}
function after_end(){
return function () {
if(backBtn_clickflag){
backBtn_clickflag =false;
showUI2();
}
}
}