标签:
CABasicAnimation动画
1 //CABasicAnimation-不透明度 2 @IBAction func cabOpacity() 3 { 4 let animation = CABasicAnimation(keyPath: "opacity") 5 6 animation!.fromValue = 1.0 7 animation!.toValue = 0.0 8 animation.duration = 3.0 9 self.testImageView.layer.addAnimation(animation, forKey: "Image-opacity") 10 self.testImageView.alpha=0.0; 11 } 12 13 //开启 clip subview 属性 14 @IBAction func cabExpend() 15 { 16 //从小到下(如果把Mode 属性改成 Center后,此效果为遮照) 17 let animation = CABasicAnimation(keyPath: "bounds.size") 18 animation!.fromValue = NSValue(CGSize: CGSizeMake(2.0, 2.0)) 19 animation!.toValue = NSValue(CGSize: self.testImageView.frame.size) 20 animation.duration = 3.0 21 self.testImageView.layer.addAnimation(animation, forKey: "Image-expen") 22 } 23
iOS开发——动画编程Swift篇&(四)CABasicAnimation动画
标签:
原文地址:http://www.cnblogs.com/iCocos/p/4559283.html