我试图删除显示一个视图,但看起来像旋转卡的方式。
下面没有旋转视图,但不是我想要做的。连锁动画的旋转,直到视图不在窗口
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
android:duration="1500"
android:fromDegrees="0"
android:pivotX="100%"
android:pivotY="50%"
android:startOffset="0"
android:toDegrees="220" />
</set>
什么我以后是不是旋转本身围绕一个固定的中心,但类似投掷卡的议案。
我该怎么做?
更新
我想这个答案之后,从@loadedion但不工作:
ObjectAnimator rotateAnimation = ObjectAnimator.ofFloat(rootView, "rotation", 0.0f, 360f);
rotateAnimation.setDuration(5000);
ObjectAnimator throwAnimation = ObjectAnimator.ofFloat(rootView, "x", rootView.getX(), rootView.getX() + 200);
throwAnimation.setInterpolator(new AccelerateInterpolator());
throwAnimation.setDuration(3000);
ObjectAnimator throwAnimation2 = ObjectAnimator.ofFloat(rootView, "y", rootView.getY(), rootView.getY() + 200);
throwAnimation.setInterpolator(new AccelerateInterpolator());
throwAnimation.setDuration(3000);
AnimatorSet cardThrowAnimations = new AnimatorSet();
cardThrowAnimations.playSequentially(rotateAnimation, throwAnimation, throwAnimation2);
cardThrowAnimations.start();
我相信'playSequentially'会等到每个动画在开始下一个之前完成,所以看起来像这样会导致卡真正缓慢旋转5秒,然后稍稍向右移动3秒,然后稍微向下移动3秒conds。那是你所看到的吗?使用'playTogether'可以同时运行所有的动画。 – loadedion