Skip to content

Instantly share code, notes, and snippets.

@TechMaster
Created May 22, 2017 08:44
Show Gist options
  • Select an option

  • Save TechMaster/ebcbdc03b99b5bd107ef0b09f96f4ef5 to your computer and use it in GitHub Desktop.

Select an option

Save TechMaster/ebcbdc03b99b5bd107ef0b09f96f4ef5 to your computer and use it in GitHub Desktop.
Animation.swift
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.addBar()
}
func addBar() {
let bar = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
bar.backgroundColor = UIColor.red
self.view.addSubview(bar)
UIView.animate(withDuration: 10, animations: {
bar.transform = CGAffineTransform(scaleX: 5.0, y: 1.0)
}) { (complete) in
UIView.animate(withDuration: 10, animations: {
bar.transform = CGAffineTransform(scaleX: 1.0, y: 1.0)
}, completion: { (complete) in
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment