我需要以某个角度旋转时钟视图。但是动画的第二步是从初始位置开始,当我需要继续使用新的动画时。
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)
当我在完成块中尝试做一些动画时,它不会触发。在第二次按下按钮后 - 动画根本没有启动,但控制台显示“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。抱歉我的英语不好