mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 21:36:17 +00:00
more shaders
This commit is contained in:
@@ -9,8 +9,32 @@
|
|||||||
using namespace metal;
|
using namespace metal;
|
||||||
|
|
||||||
//learning shaders stuff here
|
//learning shaders stuff here
|
||||||
|
[[ stitchable ]] float2 waveFlag(float2 pos, float time, float2 size) {
|
||||||
|
float2 distance = pos/size;
|
||||||
|
pos.y += sin(time*5 + pos.x/20) * 5 * distance.x;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ stitchable ]] float2 wave(float2 pos, float time) {
|
||||||
|
pos.y += sin(time*4 + pos.y/30) * 10;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ stitchable ]] half4 rainbow(float2 pos, half4 color, float time) {
|
||||||
|
if(color.a == 0) {
|
||||||
|
return half4(0,0,0,0);
|
||||||
|
}
|
||||||
|
float angle = atan2(pos.y, pos.x) + time;
|
||||||
|
return half4(
|
||||||
|
sin(angle),
|
||||||
|
sin(angle + 2),
|
||||||
|
sin(angle + 4),
|
||||||
|
color.a
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
[[ stitchable ]] half4 opacityInvert(float2 position, half4 color) {
|
[[ stitchable ]] half4 opacityInvert(float2 position, half4 color) {
|
||||||
return half4(1, 0, 0, color.a);
|
return half4(1, 0, 0, 1-color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[ stitchable ]] half4 redify(float2 position, half4 color) {
|
[[ stitchable ]] half4 redify(float2 position, half4 color) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ struct SettingsView: View {
|
|||||||
|
|
||||||
@State private var blinkCursor: Int = 0
|
@State private var blinkCursor: Int = 0
|
||||||
@State var blinkTimer: Timer?
|
@State var blinkTimer: Timer?
|
||||||
|
@State private var start = Date.now
|
||||||
|
|
||||||
func startBlinkingIfNeeded() {
|
func startBlinkingIfNeeded() {
|
||||||
if hostsManager.settings.cursorType.blink {
|
if hostsManager.settings.cursorType.blink {
|
||||||
@@ -38,12 +39,55 @@ struct SettingsView: View {
|
|||||||
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
|
hostsManager.selectedTheme.background.suiColor.opacity(0.7)
|
||||||
.ignoresSafeArea(.all)
|
.ignoresSafeArea(.all)
|
||||||
List {
|
List {
|
||||||
Section("Terminal") {
|
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
|
||||||
|
// )
|
||||||
|
Image(systemName: "square.and.arrow.up")
|
||||||
|
.font(.system(size: 300))
|
||||||
|
.foregroundStyle(.red)
|
||||||
|
.drawingGroup()
|
||||||
|
.visualEffect {
|
||||||
|
content,
|
||||||
|
proxy in
|
||||||
|
content.distortionEffect(
|
||||||
|
ShaderLibrary.waveFlag(
|
||||||
|
.float(time),
|
||||||
|
.float2(proxy.size)
|
||||||
|
),
|
||||||
|
maxSampleOffset: .zero
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.border(.red)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
// ))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Section("Original") {
|
||||||
Image(systemName: "figure.walk.circle")
|
Image(systemName: "figure.walk.circle")
|
||||||
.font(.system(size: 300))
|
.font(.system(size: 300))
|
||||||
.foregroundStyle(.blue)
|
.foregroundStyle(.blue)
|
||||||
.colorEffect(ShaderLibrary.scanlines())
|
}
|
||||||
|
|
||||||
|
Section("Terminal") {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
HStack {
|
HStack {
|
||||||
Label("Scrollback", systemImage: "scroll")
|
Label("Scrollback", systemImage: "scroll")
|
||||||
|
|||||||
Reference in New Issue
Block a user