migration
This commit is contained in:
42
PediFoods/Views/Launch/LaunchSplashView.swift
Normal file
42
PediFoods/Views/Launch/LaunchSplashView.swift
Normal file
@@ -0,0 +1,42 @@
|
||||
import SwiftUI
|
||||
|
||||
struct LaunchSplashView: View {
|
||||
var shouldPulse: Bool = true
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@State var isAnimating = false
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geo in
|
||||
let logoTopInset = max(0, (geo.size.height - 180) / 2 - 8)
|
||||
|
||||
ZStack(alignment: .top) {
|
||||
(colorScheme == .dark ? Color.black : AppColors.backgroundLight)
|
||||
.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 0) {
|
||||
Spacer().frame(height: logoTopInset)
|
||||
|
||||
splashLogo
|
||||
.scaledToFit()
|
||||
.frame(width: 180, height: 180)
|
||||
.scaleEffect(isAnimating ? 1.03 : 0.97)
|
||||
.opacity(isAnimating ? 1.0 : 0.9)
|
||||
.animation(.easeInOut(duration: 0.9).repeatForever(autoreverses: true), value: isAnimating)
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
isAnimating = shouldPulse
|
||||
}
|
||||
.onChange(of: shouldPulse) { _, newValue in
|
||||
isAnimating = newValue
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder var splashLogo: some View {
|
||||
SwiftUI.Image("pedifoods")
|
||||
.resizable()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user