diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..cb8d7ab 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..37f8343 --- a/UIAnimation.xcodeproj/project.pbxproj +++ b/UIAnimation.xcodeproj/project.pbxproj @@ -7,6 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 1EF3C977229C59ED005A5B40 /* BronzeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EF3C976229C59ED005A5B40 /* BronzeViewController.swift */; }; + 1EF3C979229C7663005A5B40 /* SilverViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EF3C978229C7663005A5B40 /* SilverViewController.swift */; }; + 1EF3C97B229C7FD4005A5B40 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EF3C97A229C7FD4005A5B40 /* LoginViewController.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 +18,9 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1EF3C976229C59ED005A5B40 /* BronzeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeViewController.swift; sourceTree = ""; }; + 1EF3C978229C7663005A5B40 /* SilverViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilverViewController.swift; sourceTree = ""; }; + 1EF3C97A229C7FD4005A5B40 /* LoginViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewController.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 +62,9 @@ children = ( 778CE9D1229BF77300F5483E /* AppDelegate.swift */, 778CE9D3229BF77300F5483E /* ViewController.swift */, + 1EF3C976229C59ED005A5B40 /* BronzeViewController.swift */, + 1EF3C978229C7663005A5B40 /* SilverViewController.swift */, + 1EF3C97A229C7FD4005A5B40 /* LoginViewController.swift */, 778CE9D5229BF77300F5483E /* Main.storyboard */, 778CE9D8229BF77600F5483E /* Assets.xcassets */, 778CE9DA229BF77600F5483E /* LaunchScreen.storyboard */, @@ -135,7 +144,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 1EF3C977229C59ED005A5B40 /* BronzeViewController.swift in Sources */, + 1EF3C979229C7663005A5B40 /* SilverViewController.swift in Sources */, 778CE9D4229BF77300F5483E /* ViewController.swift in Sources */, + 1EF3C97B229C7FD4005A5B40 /* LoginViewController.swift in Sources */, 778CE9D2229BF77300F5483E /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -283,7 +295,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = PV6ZXMXKDK; + DEVELOPMENT_TEAM = X54K5PJVGU; INFOPLIST_FILE = "$(SRCROOT)/UIAnimation/Info.plist"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -301,7 +313,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = PV6ZXMXKDK; + DEVELOPMENT_TEAM = X54K5PJVGU; 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/paulaleite.xcuserdatad/UserInterfaceState.xcuserstate b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/paulaleite.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..b824a29 Binary files /dev/null and b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/paulaleite.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/UIAnimation.xcodeproj/xcuserdata/paulaleite.xcuserdatad/xcschemes/xcschememanagement.plist b/UIAnimation.xcodeproj/xcuserdata/paulaleite.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d7d0658 --- /dev/null +++ b/UIAnimation.xcodeproj/xcuserdata/paulaleite.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..c3a279b --- a/UIAnimation/Base.lproj/Main.storyboard +++ b/UIAnimation/Base.lproj/Main.storyboard @@ -13,34 +13,154 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -49,6 +169,33 @@ + + + + + + + + + @@ -56,12 +203,12 @@ - + - + @@ -71,7 +218,7 @@ - + @@ -79,6 +226,10 @@ + + + + @@ -122,6 +273,7 @@ + diff --git a/UIAnimation/BronzeViewController.swift b/UIAnimation/BronzeViewController.swift new file mode 100644 index 0000000..4b8c625 --- /dev/null +++ b/UIAnimation/BronzeViewController.swift @@ -0,0 +1,98 @@ +// +// BronzeViewController.swift +// UIAnimation +// +// Created by Paula Leite on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class BronzeViewController: UIViewController { + + + @IBOutlet weak var rocketBronze: UIImageView! + @IBOutlet weak var worldBronze: UIImageView! + + let backgroudColors: [UIColor] = [#colorLiteral(red: 0.2631746531, green: 0.3594709039, blue: 0.4427573681, alpha: 1), #colorLiteral(red: 0.187418063, green: 0.2592587816, blue: 0.319437258, alpha: 1)] + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + // Depois que aparecer + override func viewDidAppear(_ animated: Bool) { + + UIView.animate(withDuration: 5.0, delay: 0, options: [.curveEaseOut], animations: { + + // Alteracoes das coisas setadas anteriormente + self.rocketBronze.image = UIImage(named: "rocket.png") + self.rocketBronze.center.y = -self.rocketBronze.frame.height + self.rocketBronze.layer.zPosition = 100 + + }) + + let myPath = UIBezierPath() + //myPath.move(to: CGPoint(x: rocketBronze.center.y + rocketBronze.frame.height/2, y: rocketBronze.center.x)) + myPath.move(to: CGPoint(x: self.view.center.x, y: worldBronze.center.y)) + myPath.addLine(to: CGPoint(x: rocketBronze.center.x, y: worldBronze.center.y - rocketBronze.frame.height/2 - 900)) + + let myShapeLayer = CAShapeLayer() + myShapeLayer.strokeColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) + myShapeLayer.lineWidth = 2 + 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 = 3.5 + + myShapeLayer.add(animationGroup, forKey: "drawLine") + self.view.layer.addSublayer(myShapeLayer) + + } + + // Antes de aparecer + override func viewWillAppear(_ animated: Bool) { + + // bounds - conteudo dentro do frame + // frame - escala e posicionamento + // center - movimentacao na tela + + self.rocketBronze.center.x = self.view.center.x + self.rocketBronze.frame.size.height = self.view.frame.size.height * 0.3 + + self.worldBronze.frame.size.width = self.view.frame.size.width + self.worldBronze.center.x = self.view.center.x + self.worldBronze.center.y = self.view.frame.height + + + + } + + + @IBAction func segmentedColor(_ sender: UISegmentedControl) { + self.view.backgroundColor = backgroudColors[sender.selectedSegmentIndex] + } + + /* + // 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/LoginViewController.swift b/UIAnimation/LoginViewController.swift new file mode 100644 index 0000000..d041fab --- /dev/null +++ b/UIAnimation/LoginViewController.swift @@ -0,0 +1,33 @@ +// +// LoginViewController.swift +// UIAnimation +// +// Created by Paula Leite on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class LoginViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + @IBAction func backButtonClicked(_ sender: Any) { + dismiss(animated: true, completion: nil) + } + + /* + // 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/SilverViewController.swift b/UIAnimation/SilverViewController.swift new file mode 100644 index 0000000..c926ab1 --- /dev/null +++ b/UIAnimation/SilverViewController.swift @@ -0,0 +1,94 @@ +// +// SilverViewController.swift +// UIAnimation +// +// Created by Paula Leite on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class SilverViewController: UIViewController { + + + @IBOutlet weak var name: UILabel! + @IBOutlet weak var username: UITextField! + @IBOutlet weak var password: UITextField! + @IBOutlet weak var button: UIButton! + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + override func viewDidAppear(_ animated: Bool) { + + + + UIView.animate(withDuration: 0.5) { + self.name.center.x += self.view.bounds.width + self.username.center.x += self.view.bounds.width + self.password.center.x += self.view.bounds.width + } + + + } + + // Antes de aparecer + override func viewWillAppear(_ animated: Bool) { + + // bounds - conteudo dentro do frame + // frame - escala e posicionamento + // center - movimentacao na tela + + self.rocket.center.x = self.view.center.x + self.rocket.frame.size.height = self.view.frame.size.height * 0.3 + + 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 + + name.center.x -= view.bounds.width + username.center.x -= view.bounds.width + password.center.x -= view.bounds.width + + } + + @IBAction func login() { + UIView.animate(withDuration: 4.0, delay: 0, options: [.curveEaseOut], animations: { + + // Alteracoes das coisas setadas anteriormente + self.rocket.image = UIImage(named: "rocket.png") + self.rocket.center.y = -self.rocket.frame.height + + }, completion: { finished in + self.performSegue(withIdentifier: "loginText", sender: self) + }) + + UIView.animate(withDuration: 0.5) { + self.name.center.x += self.view.bounds.width + self.username.center.x += self.view.bounds.width + self.password.center.x += self.view.bounds.width + self.button.center.x += self.view.bounds.width + } + + } + + + + + + /* + // 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/ViewController.swift b/UIAnimation/ViewController.swift old mode 100644 new mode 100755 index 9804cbb..353a92a --- a/UIAnimation/ViewController.swift +++ b/UIAnimation/ViewController.swift @@ -8,11 +8,64 @@ import UIKit -class ViewController: UIViewController { +class ViewController: + UIViewController { + + @IBOutlet weak var world: UIImageView! + + @IBOutlet weak var rocket: UIImageView! + override func viewDidLoad() { super.viewDidLoad() + + + } + + // Depois que aparecer + override func viewDidAppear(_ animated: Bool) { + +// let circlePath = UIBezierPath(arcCenter: self.world.center, radius: self.world.frame.width, startAngle: 0, endAngle: .pi*2, clockwise: false) +// +// let animation = CAKeyframeAnimation(keyPath: #keyPath(CALayer.position)) +// +// animation.duration = 5 +// animation.repeatCount = MAXFLOAT +// animation.path = circlePath.cgPath +// +// self.rocket.layer.add(animation, forKey: nil) + + // options: .repeat, .autoreverse + // options: .curveEasyIn, .curveEaseOut, .curveEaseInOut + + UIView.animate(withDuration: 5.0, delay: 0, options: [.curveEaseOut], animations: { + + // Alteracoes das coisas setadas anteriormente + self.rocket.center.y = self.world.center.y - self.world.frame.size.height/2 + // self.rocket.transform = self.rocket.transform.rotated(by: CGFloat(Double.pi)) + + }, completion: { finished in + self.rocket.image = UIImage(named: "rocket2.png") + }) + } + + // Antes de aparecer + override func viewWillAppear(_ animated: Bool) { + + // bounds - conteudo dentro do frame + // frame - escala e posicionamento + // center - movimentacao na tela + + self.rocket.center.x = self.view.center.x + self.rocket.frame.size.height = self.view.frame.size.height * 0.3 + + 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 + + + }