0
我需要在imageview上执行一系列动画。在android中执行动画序列
1)旋转
2)旋转后进行翻译。
但是,每当我应用旋转后我翻译我的imageview。我的imageview被重置为orignal的位置,然后它翻译。 我无法使用AnimationSet,因为我以下面的方式应用动画。
我旋转ACTION_MOVE上的图像查看ACTION_MOVE 和 ACTION_UP上的转换。
PLZ帮我出
代码片段:
公共布尔onTouch(视图V,MotionEvent事件) {
if(event.getAction()==MotionEvent.ACTION_MOVE)
{
finX=event.getX();
finY=event.getY();
moved=true;
metrics= player.determineAngle(finX, finY);
//required angle is metrics[0]
Rotate3dAnimation rotate=new Rotate3dAnimation(metrics[0], metrics[0], weapon.getBackground().getMinimumWidth()/2, weapon.getBackground().getMinimumHeight()/2, 0f, false);
rotate.setDuration(50);
weapon.startAnimation(rotate);
rotate.setFillAfter(true);
}
else if(event.getAction()==MotionEvent.ACTION_UP){
rebound=new TranslateAnimation(0, 5, 0, 5);
reboundI=new OvershootInterpolator(10f);
rebound.setInterpolator(reboundI);
rebound.setDuration(500);
weapon.startAnimation(rebound);
}
}
return true;
}
}
我可以得到改造轮流做,但有没有方法用这种转换初始化另一个动画。还有其他方法可以成功实现这两个动画。 在此先感谢