所以我有这样的代码,旋转的ImageView的点周围靠近屏幕的中心如何,直到检测到碰撞旋转图像
RotateAnimation anim = new RotateAnimation(0, 360,0,135);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(2000);
image.startAnimation(anim);
我也有这个代码,检查是否存在图像之间的碰撞和另一个
Rect rc_img1 = new Rect();
image.getDrawingRect(rc_img1);
Rect rc_img2 = new Rect();
image2.getDrawingRect(rc_img2);
if (Rect.intersects(rc_img1, rc_img2)) {
}
我将如何做某种循环,不断旋转图像,直到检测到碰撞,然后它将停止旋转。我似乎无法弄清楚这一点。谢谢。
我怎么会让它不断地检查它是否在图像旋转 – Jake
只是尝试了冲突,你可以尝试anim.cancel()或anim.reset()在你相交?我假设你的if块在一个循环中。 http://developer.android.com/reference/android/view/animation/Animation.html – Recursive
正确,但它将如何继续检查动画发生时的相交?多数民众赞成在混淆我。 – Jake