I want to create a "roulette" (a simple UIImageView
with appropriate image) and spin it.
There are similar questions but they describe just how to spin with linear speed by using multiple recursive animation calls. But in my case I need to use easeIn
animation on start of spinning and easeOut
on stop. So no one answer from those topics help.
How to resolve this issue?
Code Example
func spin() {
UIView.animate(withDuration: 0.3, delay: 0, options: UIView.AnimationOptions.curveLinear, animations: { () -> Void in
self.imgViewRoulette.transform = self.imgViewRoulette.transform.rotated(by: .pi / 2)
}) { (finished) -> Void in
if finished {
self.spin()
}
}
}