Created
June 21, 2024 08:18
-
-
Save Koshimizu-Takehito/8eb8afb5425d564eb14df8a076ef51f8 to your computer and use it in GitHub Desktop.
VisualEffect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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