moderately successfully added animations to zoom between the views,,, will improve that

This commit is contained in:
breadone 2024-07-03 22:10:08 +12:00
parent 062545b4ff
commit fc005d8183
No known key found for this signature in database

View File

@ -9,6 +9,7 @@ import SwiftUI
struct ScanItemView: View {
@Environment(\.modelContext) var ctx
@Namespace private var animation
@State private var isZoomed = false
@ -26,12 +27,13 @@ struct ScanItemView: View {
Image(uiImage: scan.uiImages.first ?? UIImage(systemName: "questionmark")!)
.resizable()
.scaledToFit()
.matchedGeometryEffect(id: "images", in: animation)
.frame(maxWidth: 70, maxHeight: 70)
.padding(4)
.background(translucentColour)
.clipShape(RoundedRectangle(cornerRadius: 12))
.onTapGesture {
withAnimation(.linear) {
withAnimation(.spring) {
isZoomed = true
}
}
@ -85,12 +87,13 @@ struct ScanItemView: View {
.scaledToFit()
.frame(maxHeight: 400)
.onTapGesture {
withAnimation(.linear) {
withAnimation(.spring) {
isZoomed = false
}
}
}
}
.matchedGeometryEffect(id: "images", in: animation)
.frame(height: 400)
.tabViewStyle(PageTabViewStyle())
}