-(UIImageView *) makeRotation:(UIImageView *)image speedX:(float)X speedY:(float)Y
{
// 头文件中需要定义 PI
// #define PI 3.14159265358979323846264338327950288
if (Y<0) {
image.transform = CGAffineTransformMakeRotation(atan(X/(-Y)));
}else if(Y>0){
image.transform = CGAffineTransformMakeRotation(atanf(X/(-Y))-PI);
}
return image;
}
自己写的一个方法,x是取向右为正值,y是取向下为正值