From 99de1e12ef90e50b3ac70dd3196b595ac3037e2a Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Mon, 25 Aug 2025 19:22:53 +0100 Subject: [PATCH] sinebow yay --- ShhShell/Terminal/CRT.metal | 19 ++++ ShhShell/Views/Settings/SettingsView.swift | 102 +++++++++++---------- 2 files changed, 73 insertions(+), 48 deletions(-) diff --git a/ShhShell/Terminal/CRT.metal b/ShhShell/Terminal/CRT.metal index f2576be..1703f32 100644 --- a/ShhShell/Terminal/CRT.metal +++ b/ShhShell/Terminal/CRT.metal @@ -10,6 +10,25 @@ using namespace metal; //learning shaders stuff here +[[ stitchable ]] half4 sinebow(float2 pos, half4 color, float2 size, float time) { + float2 uv = (pos/size.x) * 2 - 1; + uv.y += 0.15; + float wave = sin(uv.x + time); + wave *= wave * 25; + float luma = abs(1 / (100 * uv.y + wave)); + + half3 waveColor = half3(0); + for (float i = 0; i < 10; i++) { + half3 rainbow = half3( + sin(0.3 + time) * 0.5 + 0.5, + sin(0.3 + 2 + sin(time * 0.3)) * 0.5 + 0.5, + sin(0.3 + 4 + time) * 0.5 + 0.5 + ); + waveColor += rainbow * luma; + } + return half4(waveColor, 1); +} + [[ stitchable ]] half4 loupe(float2 pos, SwiftUI::Layer layer, float2 size, float2 touch) { float maxDist = 0.1; float2 uv = pos/size; diff --git a/ShhShell/Views/Settings/SettingsView.swift b/ShhShell/Views/Settings/SettingsView.swift index 94e7664..51f3bdf 100644 --- a/ShhShell/Views/Settings/SettingsView.swift +++ b/ShhShell/Views/Settings/SettingsView.swift @@ -43,47 +43,55 @@ struct SettingsView: View { Section("Shaded") { TimelineView(.animation) { tl in let time = start.distance(to: tl.date) - // Image(systemName: "figure.walk.circle") - // .font(.system(size: 300)) - // .foregroundStyle(.blue) - // .distortionEffect( - // ShaderLibrary.wave( - // .float(time) - // ), - // maxSampleOffset: .zero - // ) - Rectangle() - .frame(width: 200, height: 100) - .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) - ) - } - .gesture( - DragGesture(minimumDistance: 0) - .onChanged { touch = $0.location} - ) +// Image(systemName: "figure.walk.circle") +// .font(.system(size: 300)) +// .foregroundStyle(.blue) +// .distortionEffect( +// ShaderLibrary.wave( +// .float(time) +// ), +// maxSampleOffset: .zero +// ) +// Rectangle() +// .frame(width: 200, height: 100) +// .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) +// ) +// } +// .gesture( +// DragGesture(minimumDistance: 0) +// .onChanged { touch = $0.location} +// ) } } Section("Shaded") { TimelineView(.animation) { tl in let time = start.distance(to: tl.date) - // Image(systemName: "figure.walk.circle") - // .font(.system(size: 300)) - // .foregroundStyle(.blue) - // .colorEffect(ShaderLibrary.rainbow( - // .float(time) - // )) + 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") { @@ -120,19 +128,17 @@ struct SettingsView: View { .font(.largeTitle).monospaced() .foregroundStyle(.blue) ZStack { -// switch hostsManager.settings.cursorType.cursorShape { - if hostsManager.settings.cursorType.cursorShape == .block { - Rectangle() - .frame(width: 20, height: 40) - } else if hostsManager.settings.cursorType.cursorShape == .bar { - Rectangle() - .frame(width: 4, height: 40) - } else if hostsManager.settings.cursorType.cursorShape == .underline { - Rectangle() - .frame(width: 20, height: 4) - .padding(.top, 36) - } -// } + if hostsManager.settings.cursorType.cursorShape == .block { + Rectangle() + .frame(width: 20, height: 40) + } else if hostsManager.settings.cursorType.cursorShape == .bar { + Rectangle() + .frame(width: 4, height: 40) + } else if hostsManager.settings.cursorType.cursorShape == .underline { + Rectangle() + .frame(width: 20, height: 4) + .padding(.top, 36) + } } // .padding(.leading, 248) .id(hostsManager.settings.cursorType.cursorShape)