Я пытаюсь остановить анимацию, когда изображение достигает значения toX, но оказывается, что оно не выполнило того, что я ожидал.
Анимация возвращается в исходное положение, когда оно достигает toX , Или как я могу отменить горизонтальное подпрыгивание
movingIcon - это подпрыгивание изображения
значение toX = 1000 значение toY = 400 или 800
может кто-нибудь мне помочь !!! СПАСИБО LLLLLOOOOOOOTTTTTTT !!!!!!!!
Ценится !!!!!!!!!!!
Animation bouncing = new TranslateAnimation(0, 0, 0, toY);
Animation shifting = new TranslateAnimation(0, toX, 0,0);
//set bouncing time
bouncing.setDuration(2000);
//set right moving time
shifting.setDuration(6000);
//combine bouncing and shifting animation
AnimationSet animate = new AnimationSet(true);
animate.addAnimation(bouncing);
animate.addAnimation(shifting);
//to delay object movement for 3 seconds
animate.setStartOffset(3000);
//set animate to be able to bounce
animate.setInterpolator(new BounceInterpolator());
//set image to stay at animation finish point
animate.setFillAfter(true);
movingIcon.startAnimation(animate);
if (movingIcon.getX() == toX - 65){
animate.cancel();
}