mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
implemented shader testing view (shaderplayground)
This commit is contained in:
@@ -47,7 +47,7 @@ class HostsManager: ObservableObject, @unchecked Sendable {
|
|||||||
loadFonts()
|
loadFonts()
|
||||||
loadSnippets()
|
loadSnippets()
|
||||||
loadHistory()
|
loadHistory()
|
||||||
// self.shownOnboarding = UserDefaults.standard.bool(forKey: "shownOnboarding")
|
self.shownOnboarding = UserDefaults.standard.bool(forKey: "shownOnboarding")
|
||||||
}
|
}
|
||||||
|
|
||||||
func setOnboarding(to newValue: Bool) {
|
func setOnboarding(to newValue: Bool) {
|
||||||
|
|||||||
@@ -11,64 +11,73 @@ struct ShaderTestingView: View {
|
|||||||
@State private var start = Date.now
|
@State private var start = Date.now
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Image(systemName: "figure.walk.circle")
|
GeometryReader { geo in
|
||||||
.font(.system(size: 300))
|
|
||||||
.foregroundStyle(.blue)
|
|
||||||
.colorEffect(ShaderLibrary.redify())
|
|
||||||
Section("Shaded") {
|
|
||||||
TimelineView(.animation) { tl in
|
TimelineView(.animation) { tl in
|
||||||
let time = start.distance(to: tl.date)
|
ZStack {
|
||||||
Image(systemName: "figure.walk.circle")
|
let time = start.distance(to: tl.date)
|
||||||
.font(.system(size: 300))
|
VStack {
|
||||||
.foregroundStyle(.blue)
|
HStack {
|
||||||
.distortionEffect(
|
Image(systemName: "figure.walk.circle")
|
||||||
ShaderLibrary.wave(
|
.resizable().scaledToFit()
|
||||||
.float(time)
|
.foregroundStyle(.blue)
|
||||||
),
|
Image(systemName: "arrow.right")
|
||||||
maxSampleOffset: .zero
|
.foregroundStyle(.gray)
|
||||||
)
|
.frame(width: 25, height: 25)
|
||||||
Rectangle()
|
Image(systemName: "figure.walk.circle")
|
||||||
.frame(width: 200, height: 100)
|
.resizable().scaledToFit()
|
||||||
.padding(.vertical, 20)
|
.foregroundStyle(.blue)
|
||||||
.foregroundStyle(.red)
|
.colorEffect(ShaderLibrary.redify())
|
||||||
.compositingGroup()
|
}
|
||||||
.visualEffect {
|
|
||||||
content,
|
Image(systemName: "figure.walk.circle")
|
||||||
proxy in
|
.resizable().scaledToFit()
|
||||||
content.distortionEffect(
|
.foregroundStyle(.blue)
|
||||||
ShaderLibrary.waveFlag(
|
.colorEffect(ShaderLibrary.rainbow(.float(time)))
|
||||||
.float(time),
|
|
||||||
.float2(proxy.size)
|
Image(systemName: "figure.walk.circle")
|
||||||
),
|
.resizable().scaledToFit()
|
||||||
maxSampleOffset: CGSize(width: 0, height: 40)
|
.foregroundStyle(.blue)
|
||||||
)
|
.distortionEffect(
|
||||||
|
ShaderLibrary.wave(.float(time)),
|
||||||
|
maxSampleOffset: .zero
|
||||||
|
)
|
||||||
|
Rectangle()
|
||||||
|
.padding(.vertical, 20)
|
||||||
|
.foregroundStyle(.red)
|
||||||
|
.compositingGroup()
|
||||||
|
.visualEffect {
|
||||||
|
content,
|
||||||
|
proxy in
|
||||||
|
content.distortionEffect(
|
||||||
|
ShaderLibrary.waveFlag(.float(time), .float2(proxy.size)),
|
||||||
|
maxSampleOffset: CGSize(width: 0, height: 40)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle()
|
||||||
|
.colorEffect(
|
||||||
|
ShaderLibrary.sinebow(.float2(300, 200), .float(time))
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
.brightness(0.2)
|
||||||
|
|
||||||
|
Rectangle()
|
||||||
|
.foregroundStyle(.black.opacity(1))
|
||||||
|
.visualEffect { content, proxy in
|
||||||
|
content
|
||||||
|
.colorEffect(
|
||||||
|
ShaderLibrary.crt(
|
||||||
|
.float2(proxy.size),
|
||||||
|
.float(time)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.opacity(0.75)
|
||||||
|
.blendMode(.overlay)
|
||||||
|
.allowsHitTesting(false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section("Shaded") {
|
|
||||||
TimelineView(.animation) { tl in
|
|
||||||
let time = start.distance(to: tl.date)
|
|
||||||
Rectangle()
|
|
||||||
.frame(width: 300, height: 200)
|
|
||||||
.colorEffect(
|
|
||||||
ShaderLibrary.sinebow(
|
|
||||||
.float2(300, 200),
|
|
||||||
.float(time)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Image(systemName: "figure.walk.circle")
|
|
||||||
.font(.system(size: 300))
|
|
||||||
.foregroundStyle(.blue)
|
|
||||||
.colorEffect(ShaderLibrary.rainbow(
|
|
||||||
.float(time)
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Section("Original") {
|
|
||||||
Image(systemName: "figure.walk.circle")
|
|
||||||
.font(.system(size: 300))
|
|
||||||
.foregroundStyle(.blue)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,14 @@ struct AboutView: View {
|
|||||||
.shadow(radius: 2)
|
.shadow(radius: 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NavigationLink {
|
||||||
|
ShaderTestingView()
|
||||||
|
} label: {
|
||||||
|
Text("Shader Playground")
|
||||||
|
.bold()
|
||||||
|
Text("This is a collection of all the shaders I made while learning!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.transition(.scale)
|
.transition(.scale)
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
|
|||||||
Reference in New Issue
Block a user