How to crossfade between 2 images on iPhone using Core Animation

后端 未结 6 505
既然无缘
既然无缘 2020-11-30 18:38

I\'m doing this to learn how to work with Core Animation animatable properties on iPhone (not to learn how to crossfade images, per se).

Reading similar questions on

6条回答
  •  隐瞒了意图╮
    2020-11-30 19:28

    extension UIImageView
    {
        func mySetImage(image:UIImage)
        {
            guard let currentImage = self.image where currentImage != image else { return }
            let animation = CATransition()
            animation.duration = 0.3
            animation.type = kCATransitionFade
            layer.add(animation, forKey: "ImageFade")
            self.image = image
        }
    }
    

提交回复
热议问题