Как сделать анимацию последовательной?
func addBlurTo(_ image: UIImage) -> UIImage? {
guard let ciImg = CIImage(image: image) else { return nil }
let blur = CIFilter(name: "CIGaussianBlur")
blur?.setValue(ciImg, forKey: kCIInputImageKey)
blur?.setValue(1 , forKey: kCIInputRadiusKey)
if let outputImg = blur?.outputImage {
return UIImage(ciImage: outputImg)
}
return nil
}
А для кнопки:
@IBAction func Button7(_ sender: UIButton) {
UIView.transition(with: imageView, duration: 1, options: .transitionCrossDissolve, animations: {
guard let testImage = self.imageView.image else {return}
self.imageView.image = self.addBlurTo(testImage)
}, completion: nil)
}