Scale Image Animation Swift 5.

This blog is providing how to scaling image using animation. here we are using UIView animation with CGAffineTransform. code is programmatically. 


Full Code With Scale Image:

override func viewDidLoad() {
    super.viewDidLoad()

    // ImageView with Image
    let imageV = UIImageView(frame: CGRect(x: 50, y: 100, width: 150, height: 100))
    imageV.center = view.center
    imageV.image = UIImage(named: "devImage", in: Bundle(for: type(of: self)), compatibleWith: nil)
    view.addSubview(imageV)

    // Scaling
    UIView.animate(withDuration: 6.0, animations: {
        imageV.transform = CGAffineTransform(scaleX: 2, y: 2)
    })
}


Scaling Output:

Thanks. 

Scale Image Animation Swift 5. Scale Image Animation Swift 5. Reviewed by KIRIT MODI on 23:14:00 Rating: 5

No comments:

Powered by Blogger.