QuaRang1225 / swiftui-photos

0 stars 0 forks source link

스크롤 애니메이션 시 그리드의 부자연스러운 동적 애니메이션 #9

Open QuaRang1225 opened 2 months ago

QuaRang1225 commented 2 months ago

Aug-09-2024 21-29-37

QuaRang1225 commented 2 months ago
//상단에 존재한 투명한 GeometryReader
GeometryReader{ proxy in
    let minY = proxy.frame(in: .global).minY
    Color.clear
        .onChange(of: minY) { value in
            if abs(value - lastminY) > 15 {
                lastminY = value
                withAnimation {
                    if show,lastminY < mainOffsetY {
                        show = false
                    } else if !show,lastminY > mainOffsetY {
                        show = true
                    }
                }
            }
        }
}
.frame(height: 1)