Created
June 23, 2020 13:49
-
-
Save stevencurtis/1dab2d8697b553df831cadd069fadab1 to your computer and use it in GitHub Desktop.
starcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentView: View { | |
private let startAnimationDuration = 5.0 | |
@State private var animationStart = false | |
var body: some View { | |
GeometryReader { geometry in | |
Text("A long time ago, in a galaxy far, far away... It is a period of civil war. Rebel spaceships, striking from a hidden base, have won their first victory against the evil Galactic Empire.") | |
.fontWeight(.black) | |
.font(Font.custom("System", size: 28)) | |
.foregroundColor(.yellow) | |
.multilineTextAlignment(.center) | |
.lineSpacing(10) | |
.padding() | |
.rotation3DEffect(.degrees(45), axis: (x:10, y:0, z:0)) | |
.shadow(color: .gray, radius: 1, x: 1, y: 10) | |
.frame(width: 300, height: self.animationStart ? geometry.size.height : 0) | |
.animation(Animation.linear(duration: self.startAnimationDuration)) | |
.onAppear() { | |
self.animationStart.toggle() | |
} | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment