Skip to content

Instantly share code, notes, and snippets.

@jkosoy
Last active March 8, 2016 23:31
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jkosoy/f7a625f5ea2d6bce6a43 to your computer and use it in GitHub Desktop.
Fare Weather Prototype 010
//
// ViewController.swift
// Fare Weather
//
// Created by Jamie Kosoy on 2/23/16.
// Copyright © 2016 Arbitrary. All rights reserved.
//
import UIKit
import PromiseKit
class MainViewController: UIViewController {
let backgroundView = BackgroundView()
override func viewDidLoad() {
super.viewDidLoad()
backgroundView.frame = CGRect(origin: view.frame.origin, size: CGSize(width: view.frame.size.width, height: view.frame.size.height * 1.5))
backgroundView.center.y = view.center.y
view.addSubview(backgroundView)
splitCool()
}
func splitCool() {
backgroundView.animateToState(.Split).then { _ -> Void in
self.cooler()
}
}
func cooler() {
view.backgroundColor = UIColor.appBlueColor()
backgroundView.splitStateNeedsUpdating(.Cooler)
backgroundView.animateToState(.Cooler).then { _ -> Void in
self.splitWarm()
}
}
func splitWarm() {
backgroundView.animateToState(.Split).then { _ -> Void in
self.warmer()
}
}
func warmer() {
view.backgroundColor = UIColor.appRedColor()
backgroundView.splitStateNeedsUpdating(.Warmer)
backgroundView.animateToState(.Warmer).then { _ -> Void in
self.splitCool()
}
}
override func prefersStatusBarHidden() -> Bool {
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment