diff --git a/UIAnimation.xcodeproj/project.pbxproj b/UIAnimation.xcodeproj/project.pbxproj index aebf720..84dfc87 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 */; }; + E0A13E68229C59B8007A6007 /* BronzeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A13E67229C59B8007A6007 /* BronzeViewController.swift */; }; + E0A13E6A229C59FD007A6007 /* PrataViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A13E69229C59FD007A6007 /* PrataViewController.swift */; }; + E0A13E6C229C5A25007A6007 /* OuroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A13E6B229C5A25007A6007 /* OuroViewController.swift */; }; + E0A13E6E229C7E17007A6007 /* CircularViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0A13E6D229C7E17007A6007 /* CircularViewController.swift */; }; + E0BA0D6F229DE5500042402C /* PrataShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0BA0D6E229DE5500042402C /* PrataShowViewController.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 = ""; }; + E0A13E67229C59B8007A6007 /* BronzeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BronzeViewController.swift; sourceTree = ""; }; + E0A13E69229C59FD007A6007 /* PrataViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrataViewController.swift; sourceTree = ""; }; + E0A13E6B229C5A25007A6007 /* OuroViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OuroViewController.swift; sourceTree = ""; }; + E0A13E6D229C7E17007A6007 /* CircularViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularViewController.swift; sourceTree = ""; }; + E0BA0D6E229DE5500042402C /* PrataShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrataShowViewController.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,6 +66,11 @@ children = ( 778CE9D1229BF77300F5483E /* AppDelegate.swift */, 778CE9D3229BF77300F5483E /* ViewController.swift */, + E0A13E6D229C7E17007A6007 /* CircularViewController.swift */, + E0A13E67229C59B8007A6007 /* BronzeViewController.swift */, + E0A13E69229C59FD007A6007 /* PrataViewController.swift */, + E0BA0D6E229DE5500042402C /* PrataShowViewController.swift */, + E0A13E6B229C5A25007A6007 /* OuroViewController.swift */, 778CE9D5229BF77300F5483E /* Main.storyboard */, 778CE9D8229BF77600F5483E /* Assets.xcassets */, 778CE9DA229BF77600F5483E /* LaunchScreen.storyboard */, @@ -136,7 +151,12 @@ buildActionMask = 2147483647; files = ( 778CE9D4229BF77300F5483E /* ViewController.swift in Sources */, + E0A13E6C229C5A25007A6007 /* OuroViewController.swift in Sources */, 778CE9D2229BF77300F5483E /* AppDelegate.swift in Sources */, + E0A13E6E229C7E17007A6007 /* CircularViewController.swift in Sources */, + E0A13E6A229C59FD007A6007 /* PrataViewController.swift in Sources */, + E0BA0D6F229DE5500042402C /* PrataShowViewController.swift in Sources */, + E0A13E68229C59B8007A6007 /* BronzeViewController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/rayanexavier.xcuserdatad/UserInterfaceState.xcuserstate b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/rayanexavier.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..2535f7a Binary files /dev/null and b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/rayanexavier.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/UIAnimation.xcodeproj/xcuserdata/rayanexavier.xcuserdatad/xcschemes/xcschememanagement.plist b/UIAnimation.xcodeproj/xcuserdata/rayanexavier.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d7d0658 --- /dev/null +++ b/UIAnimation.xcodeproj/xcuserdata/rayanexavier.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..13137ae 100644 --- a/UIAnimation/Base.lproj/Main.storyboard +++ b/UIAnimation/Base.lproj/Main.storyboard @@ -10,17 +10,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -29,26 +88,136 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + @@ -61,7 +230,7 @@ - + @@ -70,7 +239,7 @@ - + @@ -79,6 +248,10 @@ + + + + @@ -109,6 +282,7 @@ + diff --git a/UIAnimation/BronzeViewController.swift b/UIAnimation/BronzeViewController.swift new file mode 100644 index 0000000..7bdda6e --- /dev/null +++ b/UIAnimation/BronzeViewController.swift @@ -0,0 +1,98 @@ +// +// Bronze.swift +// UIAnimation +// +// Created by Rayane Xavier on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import Foundation +import UIKit + +class BronzeViewController: UIViewController { + + @IBOutlet weak var Foguetinho: UIImageView! + + @IBOutlet weak var Lua: UIImageView! + + @IBAction func SegmentoAction(_ sender: Any) { + if segmentoOutlet.selectedSegmentIndex == 0 { + view.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) + segmentoOutlet.tintColor = .black + + } + else{ + view.backgroundColor = #colorLiteral(red: 0.0206782259, green: 0, blue: 0.05182193965, alpha: 1) + segmentoOutlet.tintColor = .white + } + + } + + @IBOutlet weak var segmentoOutlet: UISegmentedControl! + + + override func viewDidLoad() { + + super.viewDidLoad() + + } + + override func viewDidAppear(_ animated: Bool) { + + let myFoguetinho = UIBezierPath() + myFoguetinho.move(to: CGPoint(x: self.Foguetinho.center.x, y: self.view.frame.height - self.Lua.frame.height/4)) + myFoguetinho.addLine(to: CGPoint(x: self.view.frame.width/2, y: self.Foguetinho.frame.height/1.25)) + + let mylinhadoFoguetinho = CAShapeLayer() + mylinhadoFoguetinho.strokeColor = #colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1) + mylinhadoFoguetinho.lineWidth = 2 + mylinhadoFoguetinho.path = myFoguetinho.cgPath + mylinhadoFoguetinho.strokeStart = 1 + mylinhadoFoguetinho.zPosition = -1 + view.layer.addSublayer(mylinhadoFoguetinho) + + let myEndAnimation = CABasicAnimation(keyPath: "strokeEnd") + myEndAnimation.fromValue = 0.2 + myEndAnimation.toValue = 1.0 + + //E em seguida, a que apaga + let myStartAnimation = CABasicAnimation(keyPath: "strokeStart") + myStartAnimation.fromValue = 0.0 + myStartAnimation.toValue = 0.8 + + let animationGroup = CAAnimationGroup() + animationGroup.animations = [myStartAnimation, myEndAnimation] + animationGroup.duration = 2 + + + mylinhadoFoguetinho.add(animationGroup, forKey: "drawLine") + view.layer.addSublayer(mylinhadoFoguetinho) + + UIView.animate(withDuration: 2.0, delay: 0, options: [.curveLinear], animations: { + + self.Foguetinho.center.y = self.Foguetinho.frame.height/1.25 + + + }, completion: {finished in + + + }) + } + + override func viewWillAppear(_ animated: Bool) { + // chamada para arrumar o conteudo antes de aparecer na tela + self.Lua.frame.size.width = self.view.frame.width + //tamanho do planeta + self.Lua.center.y = self.view.frame.height + // posicao do planeta + + + self.Foguetinho.frame.size.height = self.view.frame.height * 0.15 + // tamanho do foguete + self.Foguetinho.center.x = self.view.center.x + // centralizando o foguete no centro da view + self.Foguetinho.center.y = self.view.frame.height - self.Lua.frame.height/1.7 + // centralizar o centro do y do foguete no 1.25 da altura dele + } + +} diff --git a/UIAnimation/CircularViewController.swift b/UIAnimation/CircularViewController.swift new file mode 100644 index 0000000..1275926 --- /dev/null +++ b/UIAnimation/CircularViewController.swift @@ -0,0 +1,64 @@ +// +// CircularViewController.swift +// UIAnimation +// +// Created by Rayane Xavier on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class CircularViewController: UIViewController { + + @IBOutlet weak var Foguetinho: UIImageView! + + @IBOutlet weak var Lua: UIImageView! + + override func viewDidLoad() { + + super.viewDidLoad() + + } + + override func viewDidAppear(_ animated: Bool) { + + let circlePath = UIBezierPath(arcCenter: self.Lua.center, radius: self.Lua.frame.height, startAngle: 0, endAngle: .pi*2, clockwise: true) + let animation = CAKeyframeAnimation(keyPath: #keyPath(CALayer.position)) + animation.duration = 5.0 + animation.repeatCount = MAXFLOAT + animation.path = circlePath.cgPath + + Foguetinho.layer.add(animation,forKey: nil) + + let circleLayer = CAShapeLayer() + circleLayer.path = circlePath.cgPath + circleLayer.strokeColor = UIColor.white.cgColor + circleLayer.fillColor = UIColor.clear.cgColor + self.view.layer.addSublayer(circleLayer) + } + + func outraAnimacao(){ + UIView.animate(withDuration: 2.0, animations: { + self.Foguetinho.center.x = self.view.frame.width + self.Foguetinho.transform = self.Foguetinho.transform.rotated(by: 1.0 * .pi) + }) + } + + override func viewWillAppear(_ animated: Bool) { + // chamada para arrumar o conteudo antes de aparecer na tela + self.Lua.frame.size.width = self.view.frame.width + //tamanho do planeta + self.Lua.center.y = self.view.frame.height + // posicao do planeta + + + self.Foguetinho.frame.size.height = self.view.frame.height * 0.15 + // tamanho do foguete + self.Foguetinho.center.x = self.view.center.x + // centralizando o foguete no centro da view + self.Foguetinho.center.y = self.Foguetinho.frame.height/1.25 + // centralizar o centro do y do foguete no 1.25 da altura dele + } + +} + diff --git a/UIAnimation/OuroViewController.swift b/UIAnimation/OuroViewController.swift new file mode 100644 index 0000000..2603c60 --- /dev/null +++ b/UIAnimation/OuroViewController.swift @@ -0,0 +1,21 @@ +// +// Ouro.swift +// UIAnimation +// +// Created by Rayane Xavier on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import Foundation +import UIKit + + +class OuroViewController: UIViewController { + + override func viewDidLoad() { + + super.viewDidLoad() + + } + +} diff --git a/UIAnimation/PrataShowViewController.swift b/UIAnimation/PrataShowViewController.swift new file mode 100644 index 0000000..8a68a3f --- /dev/null +++ b/UIAnimation/PrataShowViewController.swift @@ -0,0 +1,32 @@ +// +// PrataShow.swift +// UIAnimation +// +// Created by Rayane Xavier on 28/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import Foundation +import UIKit + +class PrataShowViewController: UIViewController { + + @IBOutlet weak var Foguetinho: UIImageView! + + @IBOutlet weak var Lua: UIImageView! + override func viewDidLoad() { + + super.viewDidLoad() + + self.Lua.frame.size.width = self.view.frame.width + self.Lua.center.y = self.view.frame.height + + self.Foguetinho.frame.size.height = self.view.frame.height * 0.15 + // tamanho do foguete + self.Foguetinho.center.x = self.view.center.x + // centralizando o foguete no centro da view + self.Foguetinho.center.y = self.view.frame.height - self.Lua.frame.height/1.7 + + } + +} diff --git a/UIAnimation/PrataViewController.swift b/UIAnimation/PrataViewController.swift new file mode 100644 index 0000000..996ddb6 --- /dev/null +++ b/UIAnimation/PrataViewController.swift @@ -0,0 +1,109 @@ +// +// Prata.swift +// UIAnimation +// +// Created by Rayane Xavier on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import Foundation +import UIKit + +class PrataViewController: UIViewController { + + @IBOutlet weak var Foguetinho: UIImageView! + + @IBOutlet weak var Lua: UIImageView! + + + @IBOutlet weak var textFildNome: UITextField! + + + @IBOutlet weak var textFildSenha: UITextField! + + @IBOutlet weak var ButtonLoginOutlet: UIButton! + + @IBAction func ButtonLogin(_ sender: Any) { + + let myFoguetinho = UIBezierPath() + myFoguetinho.move(to: CGPoint(x: self.Foguetinho.center.x, y: self.view.frame.height - self.Lua.frame.height/4)) + myFoguetinho.addLine(to: CGPoint(x: self.view.frame.width/2, y: self.Foguetinho.frame.height/1.25)) + + let mylinhadoFoguetinho = CAShapeLayer() + mylinhadoFoguetinho.strokeColor = #colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1) + mylinhadoFoguetinho.lineWidth = 2 + mylinhadoFoguetinho.path = myFoguetinho.cgPath + mylinhadoFoguetinho.strokeStart = 1 + mylinhadoFoguetinho.zPosition = -1 + view.layer.addSublayer(mylinhadoFoguetinho) + + let myEndAnimation = CABasicAnimation(keyPath: "strokeEnd") + myEndAnimation.fromValue = 0.2 + myEndAnimation.toValue = 1.0 + + //E em seguida, a que apaga + let myStartAnimation = CABasicAnimation(keyPath: "strokeStart") + myStartAnimation.fromValue = 0.0 + myStartAnimation.toValue = 0.8 + + let animationGroup = CAAnimationGroup() + animationGroup.animations = [myStartAnimation, myEndAnimation] + animationGroup.duration = 1.25 + + + mylinhadoFoguetinho.add(animationGroup, forKey: "drawLine") + view.layer.addSublayer(mylinhadoFoguetinho) + + UIView.animate(withDuration: 1.25, delay: 0, options: [.curveLinear], animations: { + + self.Foguetinho.center.y = self.Foguetinho.frame.height/1.25 + + + }, completion: {finished in + + if let viewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "PrataShow") as? PrataShowViewController { + self.present(viewController, animated: true, completion: nil) + } + + }) + } + + override func viewDidLoad() { + + super.viewDidLoad() + + } + override func viewDidAppear(_ animated: Bool) { + + self.textFildNome.center.x = self.view.center.x + self.textFildNome.center.y = self.view.frame.height/2.20 + + self.textFildSenha.center.x = self.view.center.x + self.textFildSenha.center.y = self.view.frame.height/1.65 + + } + + override func viewWillAppear(_ animated: Bool) { + // chamada para arrumar o conteudo antes de aparecer na tela + self.Lua.frame.size.width = self.view.frame.width + //tamanho do planeta + self.Lua.center.y = self.view.frame.height + // posicao do planeta + + UIView.animate(withDuration: 1.25) { + self.Foguetinho.frame.size.height = self.view.frame.height * 0.15 + // tamanho do foguete + self.Foguetinho.center.x = self.view.center.x + // centralizando o foguete no centro da view + self.Foguetinho.center.y = self.view.frame.height - self.Lua.frame.height/1.7 + + self.textFildNome.center.x = self.view.frame.minX + self.textFildNome.frame.width + self.textFildNome.frame.width + + self.textFildNome.center.y = self.view.frame.height/2.20 + + self.textFildSenha.center.x = self.view.frame.minX - self.textFildNome.frame.width + self.textFildSenha.center.y = self.view.frame.height/1.65 + } + + } +} diff --git a/UIAnimation/ViewController.swift b/UIAnimation/ViewController.swift index 9804cbb..da0e9eb 100644 --- a/UIAnimation/ViewController.swift +++ b/UIAnimation/ViewController.swift @@ -10,11 +10,54 @@ import UIKit class ViewController: UIViewController { + @IBOutlet weak var Lua: UIImageView! + @IBOutlet weak var Foguetinho: UIImageView! + override func viewDidLoad() { + super.viewDidLoad() } + + override func viewDidAppear(_ animated: Bool) { + UIView.animate(withDuration: 2.0, delay: 1, options: [ .curveEaseOut], animations: { + // options: opcional de colocar + // repeat: repete a animacao, autoreverse: faz o efeito contrario da animacao, curveEaseIn: comeca lento e depois acelera, curveEaseOut: comeca rapido e depois desacelera, curveEaseInOut: suave, acelera, suave. + self.Foguetinho.center.y = self.view.frame.height - self.Lua.frame.height/2 + self.Foguetinho.transform = self.Foguetinho.transform.rotated(by: .pi) + // transforma: transforma o objeto durante a animacao, rotated: roda em 180 gruas o objeto + self.Foguetinho.transform = self.Foguetinho.transform.scaledBy(x: 2, y: 2) + // aumenta o objeto pelo dobro do tamanho + }, completion: {finished in + // self.Foquetinho.image = UIImage(named: "rocket2.png") + self.outraAnimacao() + + }) +} + func outraAnimacao(){ + UIView.animate(withDuration: 2.0, animations: { + self.Foguetinho.center.x = self.view.frame.width + self.Foguetinho.transform = self.Foguetinho.transform.rotated(by: 1.0 * .pi) + }) + } + + override func viewWillAppear(_ animated: Bool) { + // chamada para arrumar o conteudo antes de aparecer na tela + self.Lua.frame.size.width = self.view.frame.width + //tamanho do planeta + self.Lua.center.y = self.view.frame.height + // posicao do planeta + + + self.Foguetinho.frame.size.height = self.view.frame.height * 0.15 + // tamanho do foguete + self.Foguetinho.center.x = self.view.center.x + // centralizando o foguete no centro da view + self.Foguetinho.center.y = self.Foguetinho.frame.height/1.25 + // centralizar o centro do y do foguete no 1.25 da altura dele + } + }