一、reveal
1.
先新建一个图像视图image
然后创建动画,并且把它添加到相应图层
let animation = CATransition()
//可以使用两种方法,实现动画效果,一种是视图层面的,另一种是使用过度动画,它实现了低层的过渡动画,因此可以进行更低层次的控制
animation.duration = 2
//设置动画时长2秒
animation.timingFunction = CAMediaTimingFunction(name: .easeOut)
//设置动画的播放速度为由慢到快
animation.type = CATransitionType.reveal
//设置动画的类型为渐显动画
imageView.layer.add(animation, forKey: "Reveal")
//将动画指定给图像视图的层
二、Push
1.创建区域
2. 创建动画
let rect1 = CGRect(x: 100, y: 500, width: 320, height: 211)
let imageView1 = UIImageView(frame: rect1)
let image1 = UIImage(named: "u=1126550437,2113426697&fm=26&gp=0的副本")
imageView1.image = image1
self.view.addSubview(imageView1)
let animation1 = CATransition()
animation1.duration = 30
animation1.timingFunction = CAMediaTimingFunction(name: .easeOut)
animation1.type = CATransitionType.push
imageView1.layer.add(animation1, forKey: "Push")