Could someone please provide me with an example of animating the opacity of an Image View in swift??
I couldn\'t even find a good example in objective c
You can also write it like this:
animation.fromValue = 0.0
animation.toValue = 1.0
The whole code should be like this:
let animation = CABasicAnimation(#keyPath(CALayer.opacity))
animation.fromValue = 0.0
animation.toValue = 1.0
animation.duration = 1.0
animation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
element.layer?.addAnimation(animation, forKey: "fade")