diff --git a/UIAnimation.xcodeproj/project.pbxproj b/UIAnimation.xcodeproj/project.pbxproj index aebf720..63d02ad 100644 --- a/UIAnimation.xcodeproj/project.pbxproj +++ b/UIAnimation.xcodeproj/project.pbxproj @@ -12,6 +12,11 @@ 778CE9D7229BF77300F5483E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 778CE9D5229BF77300F5483E /* Main.storyboard */; }; 778CE9D9229BF77600F5483E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 778CE9D8229BF77600F5483E /* Assets.xcassets */; }; 778CE9DC229BF77600F5483E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 778CE9DA229BF77600F5483E /* LaunchScreen.storyboard */; }; + B66C1EF8229C72CE00B3B0DF /* PrataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66C1EF7229C72CE00B3B0DF /* PrataViewController.swift */; }; + B66C1EFA229C7D3B00B3B0DF /* LoggedInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66C1EF9229C7D3B00B3B0DF /* LoggedInViewController.swift */; }; + B66C1EFC229C860700B3B0DF /* OuroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66C1EFB229C860700B3B0DF /* OuroViewController.swift */; }; + B66C1EFF229C97DE00B3B0DF /* CustomCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = B66C1EFE229C97DE00B3B0DF /* CustomCard.swift */; }; + B6DB5A67229C59AD00AFA4B2 /* BronzeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6DB5A66229C59AD00AFA4B2 /* BronzeViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +27,11 @@ 778CE9D8229BF77600F5483E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 778CE9DB229BF77600F5483E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 778CE9DD229BF77600F5483E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B66C1EF7229C72CE00B3B0DF /* PrataViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrataViewController.swift; sourceTree = ""; }; + B66C1EF9229C7D3B00B3B0DF /* LoggedInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoggedInViewController.swift; sourceTree = ""; }; + B66C1EFB229C860700B3B0DF /* OuroViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuroViewController.swift; sourceTree = ""; }; + B66C1EFE229C97DE00B3B0DF /* CustomCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomCard.swift; sourceTree = ""; }; + B6DB5A66229C59AD00AFA4B2 /* BronzeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -54,8 +64,9 @@ 778CE9D0229BF77300F5483E /* UIAnimation */ = { isa = PBXGroup; children = ( + B66C1EFD229C978C00B3B0DF /* View */, + B6DB5A68229C59BC00AFA4B2 /* Controller */, 778CE9D1229BF77300F5483E /* AppDelegate.swift */, - 778CE9D3229BF77300F5483E /* ViewController.swift */, 778CE9D5229BF77300F5483E /* Main.storyboard */, 778CE9D8229BF77600F5483E /* Assets.xcassets */, 778CE9DA229BF77600F5483E /* LaunchScreen.storyboard */, @@ -64,6 +75,26 @@ path = UIAnimation; sourceTree = ""; }; + B66C1EFD229C978C00B3B0DF /* View */ = { + isa = PBXGroup; + children = ( + B66C1EFE229C97DE00B3B0DF /* CustomCard.swift */, + ); + path = View; + sourceTree = ""; + }; + B6DB5A68229C59BC00AFA4B2 /* Controller */ = { + isa = PBXGroup; + children = ( + 778CE9D3229BF77300F5483E /* ViewController.swift */, + B6DB5A66229C59AD00AFA4B2 /* BronzeViewController.swift */, + B66C1EF7229C72CE00B3B0DF /* PrataViewController.swift */, + B66C1EF9229C7D3B00B3B0DF /* LoggedInViewController.swift */, + B66C1EFB229C860700B3B0DF /* OuroViewController.swift */, + ); + path = Controller; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -135,8 +166,13 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + B6DB5A67229C59AD00AFA4B2 /* BronzeViewController.swift in Sources */, + B66C1EFA229C7D3B00B3B0DF /* LoggedInViewController.swift in Sources */, 778CE9D4229BF77300F5483E /* ViewController.swift in Sources */, 778CE9D2229BF77300F5483E /* AppDelegate.swift in Sources */, + B66C1EF8229C72CE00B3B0DF /* PrataViewController.swift in Sources */, + B66C1EFC229C860700B3B0DF /* OuroViewController.swift in Sources */, + B66C1EFF229C97DE00B3B0DF /* CustomCard.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -283,7 +319,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = PV6ZXMXKDK; + DEVELOPMENT_TEAM = 87G2Y58K9U; INFOPLIST_FILE = "$(SRCROOT)/UIAnimation/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -301,7 +337,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = PV6ZXMXKDK; + DEVELOPMENT_TEAM = 87G2Y58K9U; INFOPLIST_FILE = "$(SRCROOT)/UIAnimation/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/nicolau.xcuserdatad/UserInterfaceState.xcuserstate b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/nicolau.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..bc09787 Binary files /dev/null and b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/nicolau.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/UIAnimation.xcodeproj/xcuserdata/nicolau.xcuserdatad/xcschemes/xcschememanagement.plist b/UIAnimation.xcodeproj/xcuserdata/nicolau.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d7d0658 --- /dev/null +++ b/UIAnimation.xcodeproj/xcuserdata/nicolau.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + UIAnimation.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/UIAnimation/Base.lproj/Main.storyboard b/UIAnimation/Base.lproj/Main.storyboard index c20059c..79a5ad5 100644 --- a/UIAnimation/Base.lproj/Main.storyboard +++ b/UIAnimation/Base.lproj/Main.storyboard @@ -13,55 +13,195 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + - + - + @@ -71,7 +211,7 @@ - + @@ -79,6 +219,10 @@ + + + + @@ -122,6 +266,7 @@ + diff --git a/UIAnimation/Controller/BronzeViewController.swift b/UIAnimation/Controller/BronzeViewController.swift new file mode 100644 index 0000000..93f34c1 --- /dev/null +++ b/UIAnimation/Controller/BronzeViewController.swift @@ -0,0 +1,94 @@ +// +// BronzeViewController.swift +// UIAnimation +// +// Created by Lucas Fernandez Nicolau on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +func delay(_ seconds: Double, completion: @escaping ()->Void) { + DispatchQueue.main.asyncAfter(deadline: .now() + seconds, execute: completion) +} + +class BronzeViewController: UIViewController { + + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + + let backgroundColors = [#colorLiteral(red: 0.2039215686, green: 0.2862745098, blue: 0.368627451, alpha: 1), #colorLiteral(red: 0.5333333333, green: 0.7529411765, blue: 0.968627451, alpha: 1)] + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + self.world.frame.size.width = self.view.frame.size.width + self.world.center.x = self.view.center.x + self.world.center.y = self.view.frame.height + + self.rocket.center.x = self.view.center.x + self.rocket.center.y = self.world.center.y - self.world.frame.height / 2 + self.rocket.frame.size.height = self.view.frame.size.height * 0.30 + self.rocket.layer.zPosition = 1000 + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + UIView.animate(withDuration: 5.0, delay: 0, options: [.curveLinear], animations: { + self.rocket.image = #imageLiteral(resourceName: "rocket") + self.rocket.center.y = -self.rocket.frame.height + }) + + delay(1.5) { + self.createSegmentedAnimation(from: CGPoint(x: self.view.center.x, y: self.view.center.y), to: CGPoint(x: self.view.center.x, y: -100), withDuration: 5.0) + } + + delay(2.0) { + self.createSegmentedAnimation(from: CGPoint(x: self.view.center.x - 40, y: self.view.center.y), to: CGPoint(x: self.view.center.x - 40, y: -100), withDuration: 3.0) + + self.createSegmentedAnimation(from: CGPoint(x: self.view.center.x + 40, y: self.view.center.y), to: CGPoint(x: self.view.center.x + 40, y: -100), withDuration: 3.0) + } + } + + @IBAction func segmentedChanged(_ sender: UISegmentedControl) { + self.view.backgroundColor = backgroundColors[sender.selectedSegmentIndex] + } + + func createSegmentedAnimation(from start: CGPoint, to end: CGPoint, withDuration duration: TimeInterval) { + let myPath = UIBezierPath() + myPath.move(to: start) + myPath.addLine(to: end) + + let myShapeLayer = CAShapeLayer() + myShapeLayer.strokeColor = #colorLiteral(red: 0.9999960065, green: 1, blue: 1, alpha: 1) + myShapeLayer.lineWidth = 2 + myShapeLayer.path = myPath.cgPath + myShapeLayer.strokeStart = 0.8 + + // Animacão para desenhar a linha + let myEndAnimation = CABasicAnimation(keyPath: "strokeEnd") + myEndAnimation.fromValue = 0.2 + myEndAnimation.toValue = 1.0 + + // Animação para apagar a linha + let myStartAnimation = CABasicAnimation(keyPath: "strokeStart") + myStartAnimation.fromValue = 0.0 + myStartAnimation.toValue = 0.8 + + let animationGroup = CAAnimationGroup() + animationGroup.animations = [myStartAnimation, myEndAnimation] + animationGroup.duration = duration + + myShapeLayer.add(animationGroup, forKey: "drawLine") + self.view.layer.addSublayer(myShapeLayer) + } +} diff --git a/UIAnimation/Controller/LoggedInViewController.swift b/UIAnimation/Controller/LoggedInViewController.swift new file mode 100644 index 0000000..0200e88 --- /dev/null +++ b/UIAnimation/Controller/LoggedInViewController.swift @@ -0,0 +1,24 @@ +// +// LoggedInViewController.swift +// UIAnimation +// +// Created by Lucas Fernandez Nicolau on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class LoggedInViewController: UIViewController { + + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + + override func viewDidLoad() { + super.viewDidLoad() + } + + @IBAction func dismissVC(_ sender: UIButton) { + self.dismiss(animated: true, completion: nil) + } +} diff --git a/UIAnimation/Controller/OuroViewController.swift b/UIAnimation/Controller/OuroViewController.swift new file mode 100644 index 0000000..78a85d7 --- /dev/null +++ b/UIAnimation/Controller/OuroViewController.swift @@ -0,0 +1,133 @@ +// +// OuroViewController.swift +// UIAnimation +// +// Created by Lucas Fernandez Nicolau on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class OuroViewController: UIViewController { + + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + + @IBOutlet weak var myCard: Card! + + var originalFrame: CGRect! + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + guard let appDelegate = (UIApplication.shared.delegate as? AppDelegate) else { return } + guard let window = appDelegate.window else { return } + + self.myCard.center = window.center + + originalFrame = myCard.frame + + self.view.frame.size.height += self.tabBarController?.tabBar.frame.size.height ?? 0 + } + + @IBAction func cardTouched() { + + if !self.myCard.isOpened { + openCard() + } else { + closeCard() + } + } + + func openCard() { + + // Move Up a little bit + UIView.animate(withDuration: 0.15) { + self.myCard.center.y -= 30 + } + + // Bounce Up + UIView.animate(withDuration: 0.35, delay: 0.15, options: [.curveEaseIn], animations: { + + self.tabBarController?.tabBar.center.y += 100 + self.changeSize(withInsetW: 20, andInsetH: 20) + + }) { completed in + + // Bounce Down + UIView.animate(withDuration: 0.2, delay: 0.2, options: [.curveEaseIn], animations: { + + + self.changeSize(withInsetW: -5, andInsetH: -5) + + }, completion: { completed in + + // Fit Size + UIView.animate(withDuration: 0.2, delay: 0.2, options: [.curveEaseIn], animations: { + + self.changeSize() + + }, completion: { completed in + + self.myCard.isOpened = true + }) + }) + } + } + + func closeCard() { + // Move Down a little bit + UIView.animate(withDuration: 0.15) { + self.myCard.center.y += 30 + self.tabBarController?.tabBar.isHidden = false + } + + // Bounce Down + UIView.animate(withDuration: 0.35, delay: 0.15, options: [.curveEaseIn], animations: { + + self.tabBarController?.tabBar.center.y -= 100 + self.changeSize(using: self.originalFrame, withInsetW: -20, andInsetH: -20) + + }) { completed in + + // Bounce Up + UIView.animate(withDuration: 0.2, delay: 0.2, options: [.curveEaseIn], animations: { + + self.changeSize(using: self.originalFrame, withInsetW: 5, andInsetH: 5) + + }, completion: { completed in + + // Fit Size + UIView.animate(withDuration: 0.2, delay: 0.2, options: [.curveEaseIn], animations: { + + self.changeSize(using: self.originalFrame) + + }, completion: { completed in + + self.myCard.isOpened = false + }) + }) + } + } + + func changeSize(using frame: CGRect = CGRect.zero, withInsetW insetW: CGFloat = 0, andInsetH insetH: CGFloat = 0) { + + guard let appDelegate = (UIApplication.shared.delegate as? AppDelegate) else { return } + guard let window = appDelegate.window else { return } + + if (frame == CGRect.zero) { + self.myCard.frame.size.width = window.frame.width + insetW + self.myCard.frame.size.height = window.frame.height + insetH + self.myCard.center = window.center + } else { + self.myCard.frame.size.width = frame.width + insetW + self.myCard.frame.size.height = frame.height + insetH + self.myCard.center = window.center + } + } +} diff --git a/UIAnimation/Controller/PrataViewController.swift b/UIAnimation/Controller/PrataViewController.swift new file mode 100644 index 0000000..80a685d --- /dev/null +++ b/UIAnimation/Controller/PrataViewController.swift @@ -0,0 +1,112 @@ +// +// PrataViewController.swift +// UIAnimation +// +// Created by Lucas Fernandez Nicolau on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class PrataViewController: UIViewController, UITextFieldDelegate { + + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + + @IBOutlet var loginButton: UIButton! + @IBOutlet var heading: UILabel! + @IBOutlet var username: UITextField! + @IBOutlet var password: UITextField! + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + + override func viewDidLoad() { + super.viewDidLoad() + + username.delegate = self + password.delegate = self + + loginButton.layer.cornerRadius = 8.0 + loginButton.layer.masksToBounds = true + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + heading.center.x = -view.bounds.width + username.center.x = -view.bounds.width + password.center.x = -view.bounds.width + loginButton.center.x = -view.bounds.width + + self.world.frame.size.width = self.view.frame.size.width + self.world.center.x = self.view.center.x + self.world.center.y = self.view.frame.height + + self.rocket.center.x = self.view.center.x + self.rocket.center.y = -self.rocket.frame.height + self.rocket.frame.size.height = self.view.frame.size.height * 0.30 + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + UIView.animate(withDuration: 2.35, delay: 0, options: [.curveEaseOut], animations: { + self.rocket.center.y = self.world.center.y - self.world.frame.height / 2 + }, completion: { finished in + self.rocket.image = #imageLiteral(resourceName: "rocket2") + + UIView.animate(withDuration: 0.5, delay: 0.0, options: [.curveEaseInOut], animations: { + self.heading.center.x = self.view.center.x + }, completion: nil) + + UIView.animate(withDuration: 0.5, delay: 0.3, options: [.curveEaseInOut], animations: { + self.username.center.x = self.view.center.x + }, completion: nil) + + UIView.animate(withDuration: 0.5, delay: 0.4, options: [.curveEaseInOut], animations: { + self.password.center.x = self.view.center.x + }, completion: nil) + + UIView.animate(withDuration: 0.5, delay: 0.5, options: [.curveEaseInOut], animations: { + self.loginButton.center.x = self.view.center.x + }, completion: nil) + }) + } + + @IBAction func login() { + UIView.animate(withDuration: 0.5, delay: 0.0, options: [.curveEaseInOut], animations: { + self.heading.center.x += self.view.bounds.width + }, completion: nil) + + UIView.animate(withDuration: 0.5, delay: 0.3, options: [.curveEaseInOut], animations: { + self.username.center.x += self.view.bounds.width + }, completion: nil) + + UIView.animate(withDuration: 0.5, delay: 0.4, options: [.curveEaseInOut], animations: { + self.password.center.x += self.view.bounds.width + }, completion: nil) + + UIView.animate(withDuration: 0.5, delay: 0.5, options: [.curveEaseInOut], animations: { + self.loginButton.center.x += self.view.bounds.width + }, completion: { completed in + + UIView.animate(withDuration: 2.35, delay: 0, options: [.curveEaseOut], animations: { + self.rocket.image = #imageLiteral(resourceName: "rocket") + self.rocket.center.y = -self.rocket.frame.height / 2 + }, completion: { completed in + self.performSegue(withIdentifier: "loggedIn", sender: self) + }) + + }) + } + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return false + } + + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + self.view.endEditing(true) + } +} diff --git a/UIAnimation/Controller/ViewController.swift b/UIAnimation/Controller/ViewController.swift new file mode 100644 index 0000000..e09cb20 --- /dev/null +++ b/UIAnimation/Controller/ViewController.swift @@ -0,0 +1,58 @@ +// +// ViewController.swift +// UIAnimation_base +// +// Created by Pedro Cacique on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + + override var preferredStatusBarStyle: UIStatusBarStyle { + return .lightContent + } + + override func viewDidLoad() { + super.viewDidLoad() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + // bounds - conteúdo dentro do frame + // frame - escala e posicionamento + // center - movimentação na tela + + self.rocket.center.x = self.view.center.x + self.rocket.frame.size.height = self.view.frame.size.height * 0.30 + + self.world.frame.size.width = self.view.frame.size.width + self.world.center.x = self.view.center.x + self.world.center.y = self.view.frame.height + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + UIView.animate(withDuration: 5.0, delay: 0, options: [.curveEaseOut], animations: { + self.rocket.center.y = self.world.center.y - self.world.frame.height / 2 + }, completion: { finished in + self.rocket.image = #imageLiteral(resourceName: "rocket2") + }) + +// let circlePath = UIBezierPath(arcCenter: self.world.center, radius: self.world.frame.width, startAngle: 0, endAngle: .pi * 2, clockwise: true) +// +// let animation = CAKeyframeAnimation(keyPath: #keyPath(CALayer.position)) +// +// animation.duration = 3.5 +// animation.repeatCount = MAXFLOAT +// animation.path = circlePath.cgPath +// +// self.rocket.layer.add(animation, forKey: nil) + } +} + diff --git a/UIAnimation/View/CustomCard.swift b/UIAnimation/View/CustomCard.swift new file mode 100644 index 0000000..6b6116e --- /dev/null +++ b/UIAnimation/View/CustomCard.swift @@ -0,0 +1,63 @@ +// +// CustomCard.swift +// UIAnimation +// +// Created by Lucas Fernandez Nicolau on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +@IBDesignable +class Card: UIButton { + var isOpened = false + + override func prepareForInterfaceBuilder() { + super.prepareForInterfaceBuilder() + setLayout() + } + + override func awakeFromNib() { + super.awakeFromNib() + setLayout() + } + + override func touchesBegan(_ touches: Set, with event: UIEvent?) { + super.touchesBegan(touches, with: event) + + if isTouchInside { + UIView.animate(withDuration: 0.2) { + self.transform = CGAffineTransform(scaleX: 0.975, y: 0.975) + } + } + } + + override func touchesEnded(_ touches: Set, with event: UIEvent?) { + super.touchesEnded(touches, with: event) + + if let first = touches.first { + if !self.point(inside: first.location(in: self), with: event) { + UIView.animate(withDuration: 0.2) { + self.transform = CGAffineTransform(scaleX: 1, y: 1) + } + } + } + } + + override func touchesMoved(_ touches: Set, with event: UIEvent?) { + super.touchesMoved(touches, with: event) + } + + override func touchesCancelled(_ touches: Set, with event: UIEvent?) { + super.touchesCancelled(touches, with: event) + + UIView.animate(withDuration: 0.2) { + self.transform = CGAffineTransform(scaleX: 1, y: 1) + } + } + + func setLayout() { + self.layer.cornerRadius = self.frame.width / 12 + self.layer.masksToBounds = true + } +} diff --git a/UIAnimation/ViewController.swift b/UIAnimation/ViewController.swift deleted file mode 100644 index 9804cbb..0000000 --- a/UIAnimation/ViewController.swift +++ /dev/null @@ -1,20 +0,0 @@ -// -// ViewController.swift -// UIAnimation_base -// -// Created by Pedro Cacique on 27/05/19. -// Copyright © 2019 Pedro Cacique. All rights reserved. -// - -import UIKit - -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - } - - -} -