我有一个警告框,想要在#34;"出现时动画下面的动画:
Scale From 0.94 to 1.0
Opacity From 0 to 1
Time 0.50ms
x1: 0.48, y1: 0.44, x2: 0.01, y2: 1.2
有人可以指导如何在swift中实现这一目标吗?
代码:
self.view.alpha = 0
UIView.animateWithDuration(0.05,
animations: { () -> Void in
self.view.alpha = 1.0
},
感谢。
答案 0 :(得分:1)
self.view.frame.origin = CGPoint(x: 0.48, y: 0.44)
self.view.layer.transform = CATransform3DMakeScale(0.94, 0.94, 1)
self.view.alpha = 0
UIView.animateWithDuration(0.05,
animations: { () -> Void in
self.view.layer.transform = CGAffineTransformIdentity
self.view.alpha = 1.0
self.view.frame.origin = CGPoint(x: 0.01, y: 1.2)
self.view.layoutIfNeeded()
})