I want to rotate a UIImageView
by roughly 10 degrees left/right but have a smooth animation, rather than a sudden turn which I see using:
player.transform = CGAffineTransformMakeRotation(angle)
Any help appreciated, thanks.
I want to rotate a UIImageView
by roughly 10 degrees left/right but have a smooth animation, rather than a sudden turn which I see using:
player.transform = CGAffineTransformMakeRotation(angle)
Any help appreciated, thanks.
A modern
Swift
solution, usingNSTimer
andCGAffineTransformMakeRotation
:Things to notice:
Connect the outlet the the
UIImageView
Play with the (1)timer pace, (2)animation pace and (3)rotation angle to get the desired results. This set of variables worked for me.
I use some code like this to achieve a similar effect (though I rotate it by 360 degrees):
I use code very similar to this to spin an image view.
Converted for Swift 3/4:
i have some code rotate 360 degrees:
call it:
[self runSpinAnimationOnView:imgView duration:0.1 rotations:M_PI_4 repeat:10];
And animation rotate some degrees and again:
If you want to rotate a uiimageview by roughly 10 degrees left/right call :
[self rotateImage:imgView duration:0.7 delay:0.0 curve:UIViewAnimationCurveEaseIn rotations:(M_PI/18)];
similar, some degress