查看计算角度360

时间:2014-03-25 15:25:22

标签: android

我在ImageView上使用RotateAnimation 像这样(模拟时钟指针): (smallhandStartDgree,smallhandStartDgree + val,Animation.RELATIVE_TO_SELF,0.5f,                 Animation.RELATIVE_TO_SELF,0.5f);

smallhandStartDgree = smallhandStartDgree + VAL;

但是smallhandStartDgree当然要大于360或小于0, 我怎样才能得到/计算出正确的角度?

1 个答案:

答案 0 :(得分:1)

使用modulo。

smallhandStartDgree=(smallhandStartDgree+val+360)%360;

虽然这对于动画api来说并不重要。

相关问题