How to realize flexible animation of pictures? It’s very simple to use SwiftUI now.

gif

var body: some View {
    ScrollView(showsIndicators: false) {
        VStack {
            GeometryReader { proxy in
                let global = proxy.frame(in: .global)
                Image("wazi")
                    .resizable()
                    .offset(y: global.minY > 0 ? -global.minY : 0)
                    .frame(height: global.minY > 0 ? UIScreen.main.bounds.height / 3 + global.minY : UIScreen.main.bounds.height / 3)
                
            }
            .frame(height: UIScreen.main.bounds.height / 3)
            
            VStack(spacing: 10) {
                ForEach(0...10, id:\.self) { num in
                    Rectangle()
                        .fill(.red.opacity(0.5))
                        .frame(height: 60)
                }
            }
        }
    }
}