diff --git a/PrimePickApp/MainView.swift b/PrimePickApp/MainView.swift index 42c6629..f1ffc3c 100644 --- a/PrimePickApp/MainView.swift +++ b/PrimePickApp/MainView.swift @@ -8,6 +8,8 @@ import SwiftUI struct MainView: View { + @State private var hue: Double = 0 + var body: some View { NavigationStack { ZStack { @@ -15,11 +17,35 @@ struct MainView: View { .ignoresSafeArea() VStack { - Text("PrimePick") - .font(.custom("Helvetica Neue", size: 40)) + Spacer() + + Text("Prime Pick") + .font(.custom("Helvetica Neue", size: 60)) + .foregroundStyle(.black) .fontWeight(.bold) - .padding(.top, 100) - .padding(.bottom, 30) + .offset(x: 2, y: 2) + .foregroundColor(Color.white) // 文字自体を白に設定 + .overlay( + LinearGradient( + gradient: Gradient(colors: [ + Color.red, Color.orange, Color.yellow, Color.green, + Color.blue, Color.purple, Color.red + ]), + startPoint: .leading, + endPoint: .trailing + ) + .mask( + Text("Prime Pick") + .font(.custom("Helvetica Neue", size: 60)) + .fontWeight(.bold) + ) + .hueRotation(Angle(degrees: hue)) + ) + .onAppear { + withAnimation(Animation.linear(duration: 1).repeatForever(autoreverses: false)) { + hue = 360 + } + } Spacer() @@ -105,6 +131,21 @@ struct LazyView: View { } } +struct RainbowTextModifier: AnimatableModifier { + var hue: Double + + var animatableData: Double { + get { hue } + set { hue = newValue } + } + + func body(content: Content) -> some View { + content + .foregroundColor(Color(hue: hue, saturation: 1, brightness: 1)) + .animation(Animation.linear(duration: 2).repeatForever(autoreverses: false)) + } +} + #Preview { MainView() }