I need to rotate clock view with some angle. But second step of animation starting at the initial position, when i need to continue its with the new one.
UIView.animate(withDuration: 0.8, delay: 0, options: [.beginFromCurrentState], animations: {
UIView.setAnimationRepeatCount(5)
self.clock.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi/4), 0, 0, 1)
}, completion: nil)
When i'm trying to do some animation in completion block it doesn't trigger. And after second pressing the button - animation doesn't launching at all, but the console is displaying "true".
@IBAction func flip(_ sender: Any) {
UIView.animate(withDuration: 0.2, animations: {
self.FirstView.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi), -1, 1, 0)
}, completion: { finished in
print(finished)
UIView.animate(withDuration: 0.2, delay: 0, usingSpringWithDamping: 0.3, initialSpringVelocity: 0, options: [], animations: {
self.FirstView.layer.transform = CATransform3DMakeRotation(CGFloat(Double.pi), -1, 1, 0)
}, completion: nil)
})}
P.S. Sorry for my poor English