Skip to content

Instantly share code, notes, and snippets.

@fredriccliver
Created January 29, 2019 05:18
Show Gist options
  • Save fredriccliver/f3c34b1d77185b3b09c9341b9c261454 to your computer and use it in GitHub Desktop.
Save fredriccliver/f3c34b1d77185b3b09c9341b9c261454 to your computer and use it in GitHub Desktop.
simplest animation
//
// 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