Created
January 29, 2019 05:18
-
-
Save fredriccliver/f3c34b1d77185b3b09c9341b9c261454 to your computer and use it in GitHub Desktop.
simplest animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// animation | |
// | |
// Created by Fredric Cliver on 29/01/2019. | |
// Copyright © 2019 Fredric Cliver. All rights reserved. | |
// | |
import Foundation | |
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var btnPressMe: UIButton! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
} | |
@IBAction func clickedPressMe(_ sender: UIButton) { | |
UIView.animate(withDuration: 1.0, delay: 0.2, options: [UIView.AnimationOptions.curveEaseIn], animations: { | |
self.btnPressMe.center = self.view.center | |
self.view.backgroundColor = UIColor.black | |
}) { (true) in | |
// do nothing. | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment