Skip to content

Instantly share code, notes, and snippets.

@DaisukeNagata
Created September 2, 2019 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaisukeNagata/4bafcbd5c11461c76140e8d9df3c68c5 to your computer and use it in GitHub Desktop.
Save DaisukeNagata/4bafcbd5c11461c76140e8d9df3c68c5 to your computer and use it in GitHub Desktop.
buttonAnimationBig
import UIKit
class ViewController: UIViewController {
let caButton = UIButton()
override func viewDidLoad() {
super.viewDidLoad()
caButton.backgroundColor = .yellow
caButton.frame = CGRect(x: 320, y: 20, width: 0, height: 0)
view.addSubview(caButton)
self.caButton.alpha = 0
self.navigationController?.navigationBar.addSubview(caButton)
buttonAnimationBig()
}
func buttonAnimationBig() {
UIView.animate(withDuration: TimeInterval(0.4),
animations: {}, completion: { _ in
UIView.animate(withDuration: 0.2,
animations: {
self.caButton.alpha = 1
self.caButton.frame.origin.x -= 50
self.caButton.frame.origin.y -= 20
self.caButton.frame.size.width += 100
self.caButton.frame.size.height += 40
})
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment