So, I have an image that I want to release on the page.
If the user clicks the button, the image will stop it, discarding the page.
I used the full-screen eventListener style to accomplish this ... and it works in some way. The problem is that dumping is pretty ~ annoying.
Is there a more efficient way for titanium to make some form of simple animation?
Here is the code snippet:
ballAnimation = Ti.UI.createAnimation({
top: ballDown.top + 0.01*heightOfScreen,
duration: someSpeedHere
}, function(){
if (hasBeenPressed){
return;
}
else if (!hasBeenPressed && ballAnimation.top > lowestPointForBall){
someFunctionHere();
}
}
);
ballAnimation.addEventListener('complete', function(){
if (hasBeenPressed){
return;
}
else if (!hasBeenPressed && ballAnimation.top > lowestPointForBall){
someFunctionHere();
} else {
ballAnimation.top = ballAnimation.top + 0.01*heightOfScreen;
ballDown.animate(ballAnimation);
}
});
ballDown.animate(ballAnimation);
source
share