Skip to content

Instantly share code, notes, and snippets.

@Koshimizu-Takehito
Created June 21, 2024 08:18
Show Gist options
  • Save Koshimizu-Takehito/8eb8afb5425d564eb14df8a076ef51f8 to your computer and use it in GitHub Desktop.
Save Koshimizu-Takehito/8eb8afb5425d564eb14df8a076ef51f8 to your computer and use it in GitHub Desktop.
VisualEffect
import SwiftUI
struct ContentView: View {
var body: some View {
ScrollView(.vertical) {
ForEach(0..<1000) { i in
RoundedRectangle(cornerRadius: 24)
.fill(.purple)
.frame(height: 100)
.padding(.horizontal)
.visualEffect { content, proxy in
let degrees = proxy.frame(in: .global).origin.y / 10
return content.hueRotation(.degrees(degrees))
}
}
}
}
}
#Preview {
ContentView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment