Skip to content

Instantly share code, notes, and snippets.

@dheerajn
Last active October 1, 2021 00:53
Show Gist options
  • Save dheerajn/c46bd361403762a6e6fcc792bf75120d to your computer and use it in GitHub Desktop.
Save dheerajn/c46bd361403762a6e6fcc792bf75120d to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State var isOuterLoading1 = false
@State var isOuterLoading2 = false
var body: some View {
VStack {
HStack {
Spacer()
Circle() // Sun
.foregroundColor(Color.orange)
.opacity(0.8)
.frame(width: 75, height: 75)
.shadow(color: .orange, radius: 20)
.padding(SwiftUI.EdgeInsets(top: 50, leading: 0, bottom: 0, trailing: 50))
}
ZStack {
// Stars
Star(corners: 5, smoothness: 0.45)
.fill(Color.white)
.frame(width: 30, height: 30)
.modifier(CustomShapeModifier())
// Outer circle - dashed lines
Circle()
.stroke(style: StrokeStyle(lineWidth: 3, lineCap: .round, dash: [30]))
.foregroundColor(.white)
.onAppear() {
withAnimation(Animation.linear(duration: 30.0).repeatForever(autoreverses: false))
{
isOuterLoading1.toggle()
}
}
.rotationEffect(Angle(degrees: isOuterLoading1 ? 0 : 360))
.frame(width: 320, alignment: .center)
// GIF
VStack {
GIFImage(name: "globe")
.frame(height: 250)
.clipShape(Circle())
}
ZStack {
// Satellite
Image(uiImage: UIImage(named: "satellite")!)
.resizable()
.rotationEffect(Angle(degrees: -20))
.frame(width: 50, height: 50)
.offset(x: -160)
// Satellite 1
Image(uiImage: UIImage(named: "satellite1")!)
.resizable()
.rotationEffect(Angle(degrees: -50))
.frame(width: 50, height: 50)
.offset(x: 160)
}
.onAppear() {
withAnimation(Animation.linear(duration: 50.0).repeatForever(autoreverses: false)) {
isOuterLoading2.toggle()
}
}
.rotationEffect(Angle(degrees: isOuterLoading2 ? 0 : 360))
.frame(width: 280, alignment: .center)
}
}
.background(Color(.black)
.opacity(0.9)
.edgesIgnoringSafeArea(.all))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment