|
|
@ -15,7 +15,9 @@ struct DailyGiftPage: View {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@State private var step: Step = .first
|
|
|
|
@State private var step: Step = .first
|
|
|
|
|
|
|
|
@State private var scale: CGFloat = 1.0
|
|
|
|
|
|
|
|
@State private var scale2: CGFloat = 0
|
|
|
|
|
|
|
|
@State private var rotate: CGFloat = 1
|
|
|
|
@Binding var show: Bool
|
|
|
|
@Binding var show: Bool
|
|
|
|
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
var body: some View {
|
|
|
@ -38,11 +40,29 @@ struct DailyGiftPage: View {
|
|
|
|
switch step {
|
|
|
|
switch step {
|
|
|
|
case .first:
|
|
|
|
case .first:
|
|
|
|
Image("giftImage")
|
|
|
|
Image("giftImage")
|
|
|
|
.transition(.scale)
|
|
|
|
.transition(
|
|
|
|
|
|
|
|
.asymmetric(
|
|
|
|
|
|
|
|
insertion: .scale(scale: 0.9).combined(with: .opacity),
|
|
|
|
|
|
|
|
removal: .scale(scale: 1.7).combined(with: .opacity))
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.scaleEffect(scale)
|
|
|
|
|
|
|
|
.rotationEffect(.degrees(Double(scale) * 10), anchor: .center)
|
|
|
|
|
|
|
|
.rotationEffect(.degrees(-10), anchor: .center)
|
|
|
|
|
|
|
|
.onAppear {
|
|
|
|
|
|
|
|
withAnimation(Animation.easeInOut(duration: 1).repeatForever()) {
|
|
|
|
|
|
|
|
scale = 1.1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
case .end:
|
|
|
|
case .end:
|
|
|
|
ZStack {
|
|
|
|
ZStack {
|
|
|
|
Image("giftEarnImage")
|
|
|
|
Image("giftEarnImage")
|
|
|
|
.transition(.opacity)
|
|
|
|
.rotationEffect(.degrees(Double(rotate) * 10), anchor: .center)
|
|
|
|
|
|
|
|
.rotationEffect(.degrees(-10), anchor: .center)
|
|
|
|
|
|
|
|
.onAppear {
|
|
|
|
|
|
|
|
withAnimation(Animation.easeInOut(duration: 1).repeatForever()) {
|
|
|
|
|
|
|
|
rotate = 1.3
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
HStack {
|
|
|
|
HStack {
|
|
|
|
Text("+ 123")
|
|
|
|
Text("+ 123")
|
|
|
|
.textStyle(weight: .black, color: .white, size: 55)
|
|
|
|
.textStyle(weight: .black, color: .white, size: 55)
|
|
|
@ -51,6 +71,21 @@ struct DailyGiftPage: View {
|
|
|
|
.frame(width: 40, height: 40)
|
|
|
|
.frame(width: 40, height: 40)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.scaleEffect(scale2)
|
|
|
|
|
|
|
|
.onAppear {
|
|
|
|
|
|
|
|
withAnimation(Animation.easeInOut(duration: 0.8)) {
|
|
|
|
|
|
|
|
scale2 = 1.0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
|
|
|
|
|
|
|
|
withAnimation {
|
|
|
|
|
|
|
|
show = false
|
|
|
|
|
|
|
|
step = .first
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.onDisappear {
|
|
|
|
|
|
|
|
scale2 = 0
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.frame(width: geometry.size.width * 0.8, height: geometry.size.height * 0.4)
|
|
|
|
.frame(width: geometry.size.width * 0.8, height: geometry.size.height * 0.4)
|
|
|
@ -60,7 +95,7 @@ struct DailyGiftPage: View {
|
|
|
|
case .first:
|
|
|
|
case .first:
|
|
|
|
step = .end
|
|
|
|
step = .end
|
|
|
|
case .end:
|
|
|
|
case .end:
|
|
|
|
show.toggle()
|
|
|
|
show = false
|
|
|
|
step = .first
|
|
|
|
step = .first
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|