diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f3000f3 Binary files /dev/null and b/.DS_Store differ diff --git a/UIAnimation.xcodeproj/project.pbxproj b/UIAnimation.xcodeproj/project.pbxproj old mode 100644 new mode 100755 index aebf720..a4e2324 --- a/UIAnimation.xcodeproj/project.pbxproj +++ b/UIAnimation.xcodeproj/project.pbxproj @@ -7,6 +7,10 @@ objects = { /* Begin PBXBuildFile section */ + 7624CE4E229C5E8E007F74B4 /* BronzeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7624CE4D229C5E8E007F74B4 /* BronzeViewController.swift */; }; + 7624CE50229C5E97007F74B4 /* SilverViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7624CE4F229C5E97007F74B4 /* SilverViewController.swift */; }; + 7624CE52229C5E9F007F74B4 /* GoldViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7624CE51229C5E9F007F74B4 /* GoldViewController.swift */; }; + 7624CE54229C85AE007F74B4 /* Silver2ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7624CE53229C85AE007F74B4 /* Silver2ViewController.swift */; }; 778CE9D2229BF77300F5483E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778CE9D1229BF77300F5483E /* AppDelegate.swift */; }; 778CE9D4229BF77300F5483E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778CE9D3229BF77300F5483E /* ViewController.swift */; }; 778CE9D7229BF77300F5483E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 778CE9D5229BF77300F5483E /* Main.storyboard */; }; @@ -15,6 +19,10 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 7624CE4D229C5E8E007F74B4 /* BronzeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeViewController.swift; sourceTree = ""; }; + 7624CE4F229C5E97007F74B4 /* SilverViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilverViewController.swift; sourceTree = ""; }; + 7624CE51229C5E9F007F74B4 /* GoldViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoldViewController.swift; sourceTree = ""; }; + 7624CE53229C85AE007F74B4 /* Silver2ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Silver2ViewController.swift; sourceTree = ""; }; 778CE9CE229BF77300F5483E /* UIAnimation.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIAnimation.app; sourceTree = BUILT_PRODUCTS_DIR; }; 778CE9D1229BF77300F5483E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 778CE9D3229BF77300F5483E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; @@ -56,6 +64,10 @@ children = ( 778CE9D1229BF77300F5483E /* AppDelegate.swift */, 778CE9D3229BF77300F5483E /* ViewController.swift */, + 7624CE4D229C5E8E007F74B4 /* BronzeViewController.swift */, + 7624CE4F229C5E97007F74B4 /* SilverViewController.swift */, + 7624CE53229C85AE007F74B4 /* Silver2ViewController.swift */, + 7624CE51229C5E9F007F74B4 /* GoldViewController.swift */, 778CE9D5229BF77300F5483E /* Main.storyboard */, 778CE9D8229BF77600F5483E /* Assets.xcassets */, 778CE9DA229BF77600F5483E /* LaunchScreen.storyboard */, @@ -135,6 +147,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 7624CE54229C85AE007F74B4 /* Silver2ViewController.swift in Sources */, + 7624CE52229C5E9F007F74B4 /* GoldViewController.swift in Sources */, + 7624CE4E229C5E8E007F74B4 /* BronzeViewController.swift in Sources */, + 7624CE50229C5E97007F74B4 /* SilverViewController.swift in Sources */, 778CE9D4229BF77300F5483E /* ViewController.swift in Sources */, 778CE9D2229BF77300F5483E /* AppDelegate.swift in Sources */, ); @@ -283,7 +299,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = PV6ZXMXKDK; + DEVELOPMENT_TEAM = 4BUKN8ST5B; INFOPLIST_FILE = "$(SRCROOT)/UIAnimation/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -301,7 +317,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = PV6ZXMXKDK; + DEVELOPMENT_TEAM = 4BUKN8ST5B; INFOPLIST_FILE = "$(SRCROOT)/UIAnimation/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/UIAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/UIAnimation.xcodeproj/project.xcworkspace/contents.xcworkspacedata old mode 100644 new mode 100755 diff --git a/UIAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/UIAnimation.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist old mode 100644 new mode 100755 diff --git a/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/leonardooliveira.xcuserdatad/UserInterfaceState.xcuserstate b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/leonardooliveira.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..6ee12d5 Binary files /dev/null and b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/leonardooliveira.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/UIAnimation.xcodeproj/xcuserdata/leonardooliveira.xcuserdatad/xcschemes/xcschememanagement.plist b/UIAnimation.xcodeproj/xcuserdata/leonardooliveira.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d7d0658 --- /dev/null +++ b/UIAnimation.xcodeproj/xcuserdata/leonardooliveira.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + UIAnimation.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/UIAnimation.xcodeproj/xcuserdata/phcacique.xcuserdatad/xcschemes/xcschememanagement.plist b/UIAnimation.xcodeproj/xcuserdata/phcacique.xcuserdatad/xcschemes/xcschememanagement.plist old mode 100644 new mode 100755 diff --git a/UIAnimation/AppDelegate.swift b/UIAnimation/AppDelegate.swift old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json b/UIAnimation/Assets.xcassets/AppIcon.appiconset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-AppStore.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-AppStore.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad20.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad20.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad20@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad20@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad29.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad29.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad29@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad29@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad40.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad40.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad40@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad40@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad76.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad76.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad76@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad76@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad83@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPad83@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone20@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone20@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone20@3x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone20@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone29@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone29@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone29@3x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone29@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone40@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone40@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone40@3x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone40@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone60@2x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone60@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone60@3x.png b/UIAnimation/Assets.xcassets/AppIcon.appiconset/icon-iPhone60@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/Contents.json b/UIAnimation/Assets.xcassets/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon1.imageset/Contents.json b/UIAnimation/Assets.xcassets/icon1.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon1.imageset/icon1.png b/UIAnimation/Assets.xcassets/icon1.imageset/icon1.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon1.imageset/icon1@2x.png b/UIAnimation/Assets.xcassets/icon1.imageset/icon1@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon1.imageset/icon1@3x.png b/UIAnimation/Assets.xcassets/icon1.imageset/icon1@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon2.imageset/Contents.json b/UIAnimation/Assets.xcassets/icon2.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon2.imageset/icon2@1x.png b/UIAnimation/Assets.xcassets/icon2.imageset/icon2@1x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon2.imageset/icon2@2x.png b/UIAnimation/Assets.xcassets/icon2.imageset/icon2@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon2.imageset/icon2@3x.png b/UIAnimation/Assets.xcassets/icon2.imageset/icon2@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon3.imageset/Contents.json b/UIAnimation/Assets.xcassets/icon3.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon3.imageset/icon3.png b/UIAnimation/Assets.xcassets/icon3.imageset/icon3.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon3.imageset/icon3@2x.png b/UIAnimation/Assets.xcassets/icon3.imageset/icon3@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon3.imageset/icon3@3x.png b/UIAnimation/Assets.xcassets/icon3.imageset/icon3@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon4.imageset/Contents.json b/UIAnimation/Assets.xcassets/icon4.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon4.imageset/icon4@1x.png b/UIAnimation/Assets.xcassets/icon4.imageset/icon4@1x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon4.imageset/icon4@2x.png b/UIAnimation/Assets.xcassets/icon4.imageset/icon4@2x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/icon4.imageset/icon4@3x.png b/UIAnimation/Assets.xcassets/icon4.imageset/icon4@3x.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/rocket.imageset/Contents.json b/UIAnimation/Assets.xcassets/rocket.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/rocket.imageset/rocket.png b/UIAnimation/Assets.xcassets/rocket.imageset/rocket.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/rocket2.imageset/Contents.json b/UIAnimation/Assets.xcassets/rocket2.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/rocket2.imageset/rocket2.png b/UIAnimation/Assets.xcassets/rocket2.imageset/rocket2.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/world1.imageset/Contents.json b/UIAnimation/Assets.xcassets/world1.imageset/Contents.json old mode 100644 new mode 100755 diff --git a/UIAnimation/Assets.xcassets/world1.imageset/world1.png b/UIAnimation/Assets.xcassets/world1.imageset/world1.png old mode 100644 new mode 100755 diff --git a/UIAnimation/Base.lproj/LaunchScreen.storyboard b/UIAnimation/Base.lproj/LaunchScreen.storyboard old mode 100644 new mode 100755 diff --git a/UIAnimation/Base.lproj/Main.storyboard b/UIAnimation/Base.lproj/Main.storyboard old mode 100644 new mode 100755 index c20059c..6c6dae1 --- a/UIAnimation/Base.lproj/Main.storyboard +++ b/UIAnimation/Base.lproj/Main.storyboard @@ -13,39 +13,162 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -61,7 +184,7 @@ - + @@ -71,7 +194,7 @@ - + @@ -79,6 +202,10 @@ + + + + @@ -122,6 +249,7 @@ + diff --git a/UIAnimation/BronzeViewController.swift b/UIAnimation/BronzeViewController.swift new file mode 100644 index 0000000..323c1c9 --- /dev/null +++ b/UIAnimation/BronzeViewController.swift @@ -0,0 +1,91 @@ +// +// BronzeViewController.swift +// UIAnimation +// +// Created by Leonardo Oliveira on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class BronzeViewController: UIViewController { + + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + @IBOutlet weak var backgroundSegmentedControl: UISegmentedControl! + + override func viewDidLoad() { + super.viewDidLoad() + } + + @IBAction func backgroundSegmentedControlChange(_ sender: UISegmentedControl) { + + if backgroundSegmentedControl.selectedSegmentIndex == 0{ + self.view.backgroundColor = #colorLiteral(red: 0.262745098, green: 0.3594709039, blue: 0.4427573681, alpha: 1) + + } else if backgroundSegmentedControl.selectedSegmentIndex == 1{ + self.view.backgroundColor = UIColor.black + + } + } + + + 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.center.y = self.view.frame.height + 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) + + let myPath = UIBezierPath() + let myShapeLayer = CAShapeLayer() + + UIView.animate(withDuration: 4.0, delay: 0, options: [.curveLinear], animations: { + + self.rocket.center.y = -(self.rocket.frame.size.height/2) + self.rocket.layer.zPosition = 100 + + }, completion: { finished in + // self.rocket.image = #imageLiteral(resourceName: "rocket2") + }) + + myPath.move(to: CGPoint(x: self.rocket.center.x, y: (self.view.frame.height + self.rocket.frame.size.height))) + myPath.addLine(to: CGPoint(x: self.rocket.center.x, y: -(self.rocket.frame.size.height))) + + myShapeLayer.strokeColor = #colorLiteral(red: 0.2549020872, green: 0.2507159207, blue: 0.2587435233, alpha: 0.8967044454) + myShapeLayer.lineWidth = 10 + + myShapeLayer.path = myPath.cgPath + myShapeLayer.strokeStart = 0.8 + + let myEndAnimation = CABasicAnimation(keyPath: "strokeEnd") + myEndAnimation.fromValue = 0.2 + myEndAnimation.toValue = 1.0 + + let myStartAnimation = CABasicAnimation(keyPath: "strokeStart") + myStartAnimation.fromValue = 0.0 + myStartAnimation.toValue = 0.8 + + let animationGroup = CAAnimationGroup() + animationGroup.animations = [myStartAnimation, myEndAnimation] + animationGroup.duration = 4.2 + + myShapeLayer.add(animationGroup, forKey: "drawLine") + self.view.layer.addSublayer(myShapeLayer) + + } + + +} diff --git a/UIAnimation/GoldViewController.swift b/UIAnimation/GoldViewController.swift new file mode 100644 index 0000000..3df297e --- /dev/null +++ b/UIAnimation/GoldViewController.swift @@ -0,0 +1,30 @@ +// +// GoldViewController.swift +// UIAnimation +// +// Created by Leonardo Oliveira on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class GoldViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/UIAnimation/Info.plist b/UIAnimation/Info.plist old mode 100644 new mode 100755 diff --git a/UIAnimation/Silver2ViewController.swift b/UIAnimation/Silver2ViewController.swift new file mode 100644 index 0000000..f52b5e1 --- /dev/null +++ b/UIAnimation/Silver2ViewController.swift @@ -0,0 +1,21 @@ +// +// Silver2ViewController.swift +// UIAnimation +// +// Created by Leonardo Oliveira on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class Silver2ViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + } + + @IBAction func dismissBtnPressed(_ sender: Any) { + dismiss(animated: true, completion: nil) + } + +} diff --git a/UIAnimation/SilverViewController.swift b/UIAnimation/SilverViewController.swift new file mode 100644 index 0000000..55509bd --- /dev/null +++ b/UIAnimation/SilverViewController.swift @@ -0,0 +1,73 @@ +// +// SilverViewController.swift +// UIAnimation +// +// Created by Leonardo Oliveira on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class SilverViewController: UIViewController { + + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + @IBOutlet weak var loginTextField: UITextField! + @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var signinBtn: UIButton! + + 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.center.y = self.view.frame.size.height - self.world.frame.height / 2 + 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 + + self.loginTextField.center.x = self.loginTextField.frame.width / 2 + self.passwordTextField.center.x = self.passwordTextField.frame.width / 2 + self.signinBtn.center.x = self.signinBtn.frame.width / 2 + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + UIView.animate(withDuration: 3.0, delay: 0, options: [.curveEaseOut], animations: { + self.loginTextField.center.x = self.view.center.x + self.passwordTextField.center.x = self.view.center.x + self.signinBtn.center.x = self.view.center.x + + }, completion: { finished in + // self.rocket.image = #imageLiteral(resourceName: "rocket2") + }) + } + + @IBAction func signinBtnPressed(_ sender: UIButton) { + + UIView.animate(withDuration: 3.0, delay: 0, options: [.curveLinear], animations: { + self.rocket.image = #imageLiteral(resourceName: "rocket") + self.rocket.center.y = -(self.rocket.frame.size.height/2) + self.rocket.layer.zPosition = 100 + + }, completion: { finished in + self.performSegue(withIdentifier: "silverSegue", sender: self) + }) + + } + +} diff --git a/UIAnimation/ViewController.swift b/UIAnimation/ViewController.swift old mode 100644 new mode 100755 index 9804cbb..761c1e9 --- a/UIAnimation/ViewController.swift +++ b/UIAnimation/ViewController.swift @@ -9,10 +9,41 @@ 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") + }) }