计算旋转图像的当前角度 Iphone 与 Android
在 iOS 中查找图像轮的当前角度。
- (float) currentAngle
{
float angle = radiansToDegrees(atan2(wheeler.transform.b, wheeler.transform.a)) + 1;
if(angle < 0) {
angle = 360 + angle;
}
return angle;
}
Android 是否有具有transform.a 和transform.b 属性的等效transform 对象?现在,我使用这段代码来执行图像对象在其自身轴上的旋转。但我需要定期找出它的当前位置或角度。
RotateAnimation anim = new RotateAnimation(0f, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(1900);
imageView.startAnimation(anim);
To find the current angle of the image wheeler in iOS.
- (float) currentAngle
{
float angle = radiansToDegrees(atan2(wheeler.transform.b, wheeler.transform.a)) + 1;
if(angle < 0) {
angle = 360 + angle;
}
return angle;
}
Does Android have the equivalent tranform object that has the property of transform.a and transform.b ? Right now I am this code to perform the rotation of a image object in its own axis. but I need find out its current position or angle periodically.
RotateAnimation anim = new RotateAnimation(0f, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(1900);
imageView.startAnimation(anim);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论