|
|
@@ -8,14 +8,74 @@
|
|
|
import SwiftUI
|
|
|
|
|
|
struct ContentView: View {
|
|
|
+ @State private var animateGradient = false
|
|
|
+ @State private var appeared = false
|
|
|
+ @State private var glowPulse = false
|
|
|
+
|
|
|
+ private let text = "Hello Faiz"
|
|
|
+ private let vibrantColors: [Color] = [
|
|
|
+ Color(red: 1.0, green: 0.2, blue: 0.4),
|
|
|
+ Color(red: 1.0, green: 0.55, blue: 0.0),
|
|
|
+ Color(red: 1.0, green: 0.9, blue: 0.0),
|
|
|
+ Color(red: 0.2, green: 0.95, blue: 0.45),
|
|
|
+ Color(red: 0.0, green: 0.85, blue: 1.0),
|
|
|
+ Color(red: 0.55, green: 0.25, blue: 1.0),
|
|
|
+ Color(red: 1.0, green: 0.2, blue: 0.75),
|
|
|
+ ]
|
|
|
+
|
|
|
var body: some View {
|
|
|
- VStack {
|
|
|
- Image(systemName: "globe")
|
|
|
- .imageScale(.large)
|
|
|
- .foregroundStyle(.tint)
|
|
|
- Text("Hello, world!")
|
|
|
+ ZStack {
|
|
|
+ LinearGradient(
|
|
|
+ colors: [
|
|
|
+ Color(red: 0.05, green: 0.05, blue: 0.15),
|
|
|
+ Color(red: 0.1, green: 0.05, blue: 0.2),
|
|
|
+ Color(red: 0.05, green: 0.1, blue: 0.18),
|
|
|
+ ],
|
|
|
+ startPoint: animateGradient ? .topLeading : .bottomTrailing,
|
|
|
+ endPoint: animateGradient ? .bottomTrailing : .topLeading
|
|
|
+ )
|
|
|
+ .ignoresSafeArea()
|
|
|
+ .animation(.easeInOut(duration: 4).repeatForever(autoreverses: true), value: animateGradient)
|
|
|
+
|
|
|
+ HStack(spacing: 0) {
|
|
|
+ ForEach(Array(text.enumerated()), id: \.offset) { index, character in
|
|
|
+ Text(String(character == " " ? "\u{00A0}" : character))
|
|
|
+ .font(.system(size: 72, weight: .black, design: .rounded))
|
|
|
+ .bold()
|
|
|
+ .foregroundStyle(vibrantColors[index % vibrantColors.count])
|
|
|
+ .shadow(
|
|
|
+ color: vibrantColors[index % vibrantColors.count].opacity(glowPulse ? 0.85 : 0.35),
|
|
|
+ radius: glowPulse ? 20 : 10
|
|
|
+ )
|
|
|
+ .scaleEffect(appeared ? 1.0 : 0.1)
|
|
|
+ .opacity(appeared ? 1.0 : 0.0)
|
|
|
+ .rotationEffect(.degrees(appeared ? 0 : -30))
|
|
|
+ .offset(y: animateGradient ? -8 : 8)
|
|
|
+ .animation(
|
|
|
+ .spring(response: 0.7, dampingFraction: 0.55)
|
|
|
+ .delay(Double(index) * 0.07),
|
|
|
+ value: appeared
|
|
|
+ )
|
|
|
+ .animation(
|
|
|
+ .easeInOut(duration: 0.6)
|
|
|
+ .repeatForever(autoreverses: true)
|
|
|
+ .delay(Double(index) * 0.1),
|
|
|
+ value: animateGradient
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .padding()
|
|
|
+ }
|
|
|
+ .frame(minWidth: 560, minHeight: 280)
|
|
|
+ .onAppear {
|
|
|
+ withAnimation(.easeInOut(duration: 4).repeatForever(autoreverses: true)) {
|
|
|
+ animateGradient = true
|
|
|
+ }
|
|
|
+ withAnimation(.easeInOut(duration: 1.4).repeatForever(autoreverses: true)) {
|
|
|
+ glowPulse = true
|
|
|
+ }
|
|
|
+ appeared = true
|
|
|
}
|
|
|
- .padding()
|
|
|
}
|
|
|
}
|
|
|
|