How to get a smooth infinite rotation animation with a non-symmetrical image? I get a very brief pause between each rotation. I tried using other CalculationMode but with no luck. Has anybody any idea?
imageToRotate.hidden = false
let duration = 0.5
let delay = 0.0
let options = UIViewKeyframeAnimationOptions.CalculationModePaced | UIViewKeyframeAnimationOptions.Repeat
let fullRotation = CGFloat(M_PI * 2)
UIView.animateKeyframesWithDuration(duration, delay: delay, options: options, animations: {
UIView.addKeyframeWithRelativeStartTime(0, relativeDuration: 0, animations: {
self.imageToRotate.transform = CGAffineTransformMakeRotation(1/3 * fullRotation)
})
UIView.addKeyframeWithRelativeStartTime(0, relativeDuration: 0, animations: {
self.imageToRotate.transform = CGAffineTransformMakeRotation(2/3 * fullRotation)
})
UIView.addKeyframeWithRelativeStartTime(0, relativeDuration: 0, animations: {
self.imageToRotate.transform = CGAffineTransformMakeRotation(3/3 * fullRotation)
})
}, completion: {finished in
})
edit: I tried the approach suggested in the "possible duplicate" but unfortunately as @levigroke says with a non-symmetrical image I get a "snap" back to the original orientation after 90 degrees. He also says "One of these less elegant solutions, seen below, will truly rotate the image, but there may be a noticeable stutter when the animation is restarted". That's my initial problem so I feel that his answer won't do in my case.