// // 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 } }