Last active
March 4, 2025 23:14
-
-
Save victorBaro/3315f84d2defa9a4e927783d19f9282c to your computer and use it in GitHub Desktop.
Glowing waves shader using new SwiftUI colorEffect modifier. Used code from here: https://github.com/GrishTad/GlowingWaves - Original shadertoy implementation here: https://www.shadertoy.com/view/tlySzm
This file contains hidden or 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 GlowingWaves: View { | |
private let startDate = Date() | |
var body: some View { | |
TimelineView(.animation) { _ in | |
Rectangle() | |
.visualEffect { content, geometryProxy in | |
content | |
.colorEffect( | |
ShaderLibrary.glowingWaves( | |
.float2(geometryProxy.size), | |
.float(startDate.timeIntervalSinceNow) | |
) | |
) | |
} | |
.background( | |
Rectangle() | |
.foregroundStyle(.black) | |
) | |
} | |
} | |
} | |
#Preview { | |
GlowingWaves() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment