feat: 动画过渡

This commit is contained in:
Junhui Chen 2025-09-07 14:08:18 +08:00
parent 8f369867b2
commit 1e3ec86377

View File

@ -262,6 +262,7 @@ struct BlindBoxView: View {
// Unopened // Unopened
if data.status == "Unopened" { if data.status == "Unopened" {
print("✅ 盲盒已准备就绪,停止轮询") print("✅ 盲盒已准备就绪,停止轮询")
self.animationPhase = .ready
stopPolling() stopPolling()
break break
} }
@ -558,9 +559,9 @@ struct BlindBoxView: View {
Button(action: { Button(action: {
// BlindOutcomeView // BlindOutcomeView
if mediaType == .video, !videoURL.isEmpty, let url = URL(string: videoURL) { if mediaType == .video, !videoURL.isEmpty, let url = URL(string: videoURL) {
Router.shared.navigate(to: .blindOutcome(media: .video(url, nil), time: blindGenerate?.videoGenerateTime ?? "hhsdshjsjdhn", description:blindGenerate?.description ?? "informationinformationinformationinformationinformationinformation")) Router.shared.navigate(to: .blindOutcome(media: .video(url, nil), time: blindGenerate?.name ?? "Your box", description:blindGenerate?.description ?? ""))
} else if mediaType == .image, let image = displayImage { } else if mediaType == .image, let image = displayImage {
Router.shared.navigate(to: .blindOutcome(media: .image(image), time: blindGenerate?.videoGenerateTime ?? "hhsdshjsjdhn", description:blindGenerate?.description ?? "informationinformationinformationinformationinformationinformation")) Router.shared.navigate(to: .blindOutcome(media: .image(image), time: blindGenerate?.name ?? "Your box", description:blindGenerate?.description ?? ""))
} }
}) { }) {
Image(systemName: "chevron.left") Image(systemName: "chevron.left")
@ -656,10 +657,11 @@ struct BlindBoxView: View {
.padding(.horizontal) .padding(.horizontal)
.padding(.top, 20) .padding(.top, 20)
} }
// //
VStack(alignment: .leading, spacing: 4) { VStack(alignment: .leading, spacing: 4) {
Text("Hi! Click And") Text("Hi! Click And")
Text("Open Your First Box~") Text("Open Your Box~")
} }
.font(Typography.font(for: .smallLargeTitle)) .font(Typography.font(for: .smallLargeTitle))
.fontWeight(.bold) .fontWeight(.bold)
@ -804,7 +806,8 @@ struct BlindBoxView: View {
.animation(.easeOut(duration: 1.5), value: showScalingOverlay) .animation(.easeOut(duration: 1.5), value: showScalingOverlay)
.offset(y: showScalingOverlay ? -100 : 0) .offset(y: showScalingOverlay ? -100 : 0)
.animation(.easeInOut(duration: 1.5), value: showScalingOverlay) .animation(.easeInOut(duration: 1.5), value: showScalingOverlay)
//
// TODO
if mediaType == .all { if mediaType == .all {
Button(action: { Button(action: {
if animationPhase == .ready { if animationPhase == .ready {
@ -856,6 +859,7 @@ struct BlindBoxView: View {
.animation(.spring(response: 0.6, dampingFraction: 0.8), value: showModal) .animation(.spring(response: 0.6, dampingFraction: 0.8), value: showModal)
.edgesIgnoringSafeArea(.all) .edgesIgnoringSafeArea(.all)
} }
// //
SlideInModal( SlideInModal(
isPresented: $showModal, isPresented: $showModal,