re add ios 16 support

shaders only show if 17+
blurReplace transitions are opacity with a white shadow for a short time
This commit is contained in:
neon443
2025-08-31 22:42:43 +01:00
parent 28b92466a5
commit 262411049f
6 changed files with 79 additions and 79 deletions

View File

@@ -7,7 +7,6 @@
import Foundation
import LibSSH
import libssh2
import OSLog
import SwiftUI
import SwiftTerm

View File

@@ -11,69 +11,71 @@ struct ShaderTestingView: View {
@State private var start = Date.now
var body: some View {
TimelineView(.animation) { tl in
let time = start.distance(to: tl.date)
ZStack {
VStack {
HStack {
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.foregroundStyle(.blue)
Image(systemName: "arrow.right")
.foregroundStyle(.gray)
.frame(width: 25, height: 25)
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.foregroundStyle(.blue)
.colorEffect(ShaderLibrary.redify())
}
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.foregroundStyle(.blue)
.colorEffect(ShaderLibrary.rainbow(.float(time)))
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.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)
)
if #available(iOS 17, *) {
TimelineView(.animation) { tl in
let time = start.distance(to: tl.date)
ZStack {
VStack {
HStack {
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.foregroundStyle(.blue)
Image(systemName: "arrow.right")
.foregroundStyle(.gray)
.frame(width: 25, height: 25)
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.foregroundStyle(.blue)
.colorEffect(ShaderLibrary.redify())
}
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)
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.foregroundStyle(.blue)
.colorEffect(ShaderLibrary.rainbow(.float(time)))
Image(systemName: "figure.walk.circle")
.resizable().scaledToFit()
.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))
)
}
.opacity(0.75)
.blendMode(.overlay)
.allowsHitTesting(false)
.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)
}
}
}
}

View File

@@ -31,13 +31,13 @@ struct WelcomeChunk: View {
Text(title)
.bold()
.font(.headline)
.transition(.blurReplace)
.transition(.opacity)
}
if time > delay+0.75 && !para.isEmpty {
Text(para)
.foregroundStyle(.gray)
.font(.footnote)
.transition(.blurReplace)
.transition(.opacity)
.lineLimit(nil)
.multilineTextAlignment(.leading)
}

View File

@@ -29,7 +29,8 @@ struct WelcomeView: View {
.monospaced()
.font(.largeTitle)
.bold()
.transition(.blurReplace)
.transition(.opacity)
.shadow(color: .white, radius: time > 2.25 ? 0 : 5)
}
}
// .padding(.top, time > 3 ? 25 : 0)

View File

@@ -13,17 +13,19 @@ struct CRTView: View {
var body: some View {
TimelineView(.animation) { tl in
let time = tl.date.distance(to: startTime)
Rectangle()
.foregroundStyle(.black.opacity(1))
.visualEffect { content, proxy in
content
.colorEffect(
ShaderLibrary.crt(
.float2(proxy.size),
.float(time)
if #available(iOS 17, *) {
Rectangle()
.foregroundStyle(.black.opacity(1))
.visualEffect { content, proxy in
content
.colorEffect(
ShaderLibrary.crt(
.float2(proxy.size),
.float(time)
)
)
)
}
}
}
}
}
}