diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..ceae0ec 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..57d4a87 --- a/UIAnimation.xcodeproj/project.pbxproj +++ b/UIAnimation.xcodeproj/project.pbxproj @@ -12,6 +12,8 @@ 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 */; }; + 87C3DA92229C763600C4407B /* ViewControllerBronze.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87C3DA91229C763600C4407B /* ViewControllerBronze.swift */; }; + 87C3DA96229DD9E800C4407B /* ViewControllerPrata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87C3DA95229DD9E800C4407B /* ViewControllerPrata.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -22,6 +24,8 @@ 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 = ""; }; + 87C3DA91229C763600C4407B /* ViewControllerBronze.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerBronze.swift; sourceTree = ""; }; + 87C3DA95229DD9E800C4407B /* ViewControllerPrata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewControllerPrata.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -56,7 +60,9 @@ children = ( 778CE9D1229BF77300F5483E /* AppDelegate.swift */, 778CE9D3229BF77300F5483E /* ViewController.swift */, + 87C3DA91229C763600C4407B /* ViewControllerBronze.swift */, 778CE9D5229BF77300F5483E /* Main.storyboard */, + 87C3DA95229DD9E800C4407B /* ViewControllerPrata.swift */, 778CE9D8229BF77600F5483E /* Assets.xcassets */, 778CE9DA229BF77600F5483E /* LaunchScreen.storyboard */, 778CE9DD229BF77600F5483E /* Info.plist */, @@ -136,7 +142,9 @@ buildActionMask = 2147483647; files = ( 778CE9D4229BF77300F5483E /* ViewController.swift in Sources */, + 87C3DA92229C763600C4407B /* ViewControllerBronze.swift in Sources */, 778CE9D2229BF77300F5483E /* AppDelegate.swift in Sources */, + 87C3DA96229DD9E800C4407B /* ViewControllerPrata.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; 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/marianalima.xcuserdatad/UserInterfaceState.xcuserstate b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/marianalima.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..17248c5 Binary files /dev/null and b/UIAnimation.xcodeproj/project.xcworkspace/xcuserdata/marianalima.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/UIAnimation.xcodeproj/xcuserdata/marianalima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/UIAnimation.xcodeproj/xcuserdata/marianalima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..10d92a6 --- /dev/null +++ b/UIAnimation.xcodeproj/xcuserdata/marianalima.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/UIAnimation.xcodeproj/xcuserdata/marianalima.xcuserdatad/xcschemes/xcschememanagement.plist b/UIAnimation.xcodeproj/xcuserdata/marianalima.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..d7d0658 --- /dev/null +++ b/UIAnimation.xcodeproj/xcuserdata/marianalima.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 index 14c9c06..b7c93a6 --- a/UIAnimation/AppDelegate.swift +++ b/UIAnimation/AppDelegate.swift @@ -9,7 +9,7 @@ import UIKit @UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { +class AppDelegate: UIResponder, UIApplicationDelegate{ var window: UIWindow? 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..30d4bf1 --- a/UIAnimation/Base.lproj/Main.storyboard +++ b/UIAnimation/Base.lproj/Main.storyboard @@ -13,26 +13,89 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -40,7 +103,7 @@ - + @@ -61,7 +124,7 @@ - + @@ -79,6 +142,10 @@ + + + + diff --git a/UIAnimation/Info.plist b/UIAnimation/Info.plist old mode 100644 new mode 100755 diff --git a/UIAnimation/ViewController.swift b/UIAnimation/ViewController.swift old mode 100644 new mode 100755 index 9804cbb..3034435 --- a/UIAnimation/ViewController.swift +++ b/UIAnimation/ViewController.swift @@ -10,11 +10,69 @@ import UIKit class ViewController: UIViewController { + //puxei primeiro as duas imagens que eram o rocket e o world. + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + override func viewDidLoad() { super.viewDidLoad() } - + +//chamada para aparecer as coisas depois que carregar a tela. + override func viewDidAppear(_ animated: Bool) { + + +////aqui voce escreve o que é a sua animação. +//// em options existe o repetir, autoreverse que é pra ele continuar fazer a animacao, o ease ajuda a dar suavidade, deixar mais natural a animação. +// +// UIView.animate(withDuration: 2.0, delay: 2, options: [], animations: { +// self.rocket.center.y = self.view.frame.height - self.world.frame.height/2 +// +////transform serve para voce rotacionar a imagem (faz vezez pi que da 180 graus e assim ele da meia volta). +// self.rocket.transform = self.rocket.transform.rotated(by: .pi/2) +// +////para que voce aumente sua imagem voce v=coloca essa linha de codigo. +// self.rocket.transform = self.rocket.transform.scaledBy(x: 2, y: 2) +// +////quando acabar o tempo da animacao voce entra nesse bloco de dados. +// }, completion: { finished in +//// self.rocket.image = UIImage(named: "rocket2.png" ) +// self.outraAnimacao () +// +// }) + //para que o foguete fique orbitando em volta do mundo + let circlePath = UIBezierPath(arcCenter: self.world.center,radius: self.world.frame.height, startAngle: 0, + endAngle: .pi*2, + clockwise: true) + let animation = CAKeyframeAnimation(keyPath: #keyPath(CALayer.position)) + animation.duration = 2 + animation.repeatCount = MAXFLOAT + animation.path = circlePath.cgPath + rocket.layer.add(animation, forKey: nil) + self.rocket.transform = self.rocket.transform.rotated(by: .pi/2) + + func outraAnimacao() { + UIView.animate(withDuration: 1.5, animations: { + self.rocket.center.x = self.view.frame.width*2 + + }) + } + } + + override func viewWillAppear(_ animated: Bool) { +//chamada para arrumar o conteúdo antes de aparecer na tela (o mundo estar la em baixo e o foguete tambem), ou seja irá ficar posicionado antes de aparecer na tela. + +//tamanho e posição do mundo. + self.world.frame.size.width = self.view.frame.width + self.world.center.y = self.view.frame.height + +//tamanho e posição do foguete. + self.rocket.frame.size.height = self.view.frame.height * 0.15 + self.rocket.center.x = self.view.center.x + self.rocket.center.y = self.rocket.frame.height/2 + + } } diff --git a/UIAnimation/ViewControllerBronze.swift b/UIAnimation/ViewControllerBronze.swift new file mode 100644 index 0000000..29c41ea --- /dev/null +++ b/UIAnimation/ViewControllerBronze.swift @@ -0,0 +1,97 @@ +// +// ViewControllerBronze.swift +// UIAnimation +// +// Created by Mariana Lima on 27/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import UIKit + +class ViewControllerBronze: UIViewController{ + @IBOutlet weak var rocket: UIImageView! + @IBOutlet weak var world: UIImageView! + @IBOutlet var fundo: UIView! + @IBOutlet weak var segmentedControl: UISegmentedControl! + @IBAction func funcaoDoBotao(_ sender: Any) { + switch segmentedControl.selectedSegmentIndex { + case 0: + fundo.backgroundColor = #colorLiteral(red: 0.3321701288, green: 0.3321786821, blue: 0.3321741223, alpha: 1) + default: + fundo.backgroundColor = #colorLiteral(red: 0, green: 0, blue: 0, alpha: 1) + } + + } + override func viewDidLoad() { + super.viewDidLoad() + + } + override func viewDidAppear(_ animated: Bool) { + + let myPath = UIBezierPath() + myPath.move(to: CGPoint(x: self.rocket.center.x, y: self.view.frame.height)) + myPath.addLine(to: CGPoint(x: self.view.frame.width/2, y: self.rocket.frame.height/1.25)) + + let myShapeLayer = CAShapeLayer() + myShapeLayer.strokeColor = UIColor.white.cgColor + myShapeLayer.lineWidth = 200 + myShapeLayer.path = myPath.cgPath + myShapeLayer.strokeStart = 1 + myShapeLayer.zPosition = -1 + myShapeLayer.lineWidth = 2 + + view.layer.addSublayer(myShapeLayer) + + let myEndAnimation = CABasicAnimation(keyPath: "strokeEnd") + myEndAnimation.fromValue = 0.2 + myEndAnimation.toValue = 1.0 + + let myStartAnimation = CABasicAnimation(keyPath: "strokeStart") + myStartAnimation.fromValue = 0.2 + myStartAnimation.toValue = 0.5 + + let animationGroup = CAAnimationGroup() + animationGroup.animations = [myStartAnimation, myEndAnimation] + animationGroup.duration = 2 + + + myShapeLayer.add(animationGroup, forKey: "drawLine") + view.layer.addSublayer(myShapeLayer) + + UIView.animate(withDuration: 2.0, delay: 0, options: [], animations: { + self.world.frame.size.width = self.view.frame.width + self.world.center.y = self.view.frame.height + self.rocket.frame.size.height = self.view.frame.height * 0.15 + self.rocket.center.x = self.view.center.x + self.rocket.center.y = self.rocket.frame.height +// self.rocket.transform = self.rocket.transform.scaledBy(x: 2, y: 2) +// + }, completion: { finished in + self.rocket.image = UIImage(named: "rocket2.png" ) + self.outraAnimacao () + + }) + + + } + func outraAnimacao() { UIView.animate(withDuration: 2.0, delay: 0, options: [], animations: { + self.world.frame.size.width = self.view.frame.width + self.world.center.y = self.view.frame.height + self.rocket.frame.size.height = self.view.frame.height + self.rocket.center.x = self.world.center.x + self.rocket.center.y = self.rocket.frame.height-200 + + + + + }) + + } + + + override func viewWillAppear(_ animated: Bool) { + self.rocket.center.y = self.view.frame.height - + self.world.frame.height/2 + + } +} diff --git a/UIAnimation/ViewControllerPrata.swift b/UIAnimation/ViewControllerPrata.swift new file mode 100644 index 0000000..4a9d1bf --- /dev/null +++ b/UIAnimation/ViewControllerPrata.swift @@ -0,0 +1,16 @@ +// +// ViewControllerPrata.swift +// UIAnimation +// +// Created by Mariana Lima on 28/05/19. +// Copyright © 2019 Pedro Cacique. All rights reserved. +// + +import Foundation +import UIKit + +class ViewControllerPrata: UIViewController{ + + + +}