Android绕自身轴顺时针旋转后再逆时针旋转回来

3

如何将ImageView顺时针旋转10度,

然后停止ImageView动画(在10度处),再反向(逆时针)旋转回0度并重复此过程?

我只知道如何旋转到10度,但不知道如何返回到0度。

非常感谢。

ImageView的状态变化:0度 → 10度 → 0度(重复)

   RotateAnimation anim = new RotateAnimation(x, y, 10f, 10f);
    anim.setInterpolator(new LinearInterpolator());
    anim.setRepeatCount(Animation.INFINITE);
    anim.setDuration(700);
    imageView.startAnimation(anim);
1个回答

4

您需要设置动画的重复模式。

anim.setRepeatMode(Animation.REVERSE);

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接