From cf96b0e50530647eb1ed231acebe9c314d3c3d3a Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Wed, 27 Aug 2025 20:32:52 +0100 Subject: [PATCH] working on onboarding got animations and stuff on the onboarding --- ShhShell.xcodeproj/project.pbxproj | 4 ++ ShhShell/Views/Onboarding/WelcomeChunk.swift | 52 ++++++++++++++++++++ ShhShell/Views/Onboarding/WelcomeView.swift | 39 +++++++++++++-- 3 files changed, 91 insertions(+), 4 deletions(-) create mode 100644 ShhShell/Views/Onboarding/WelcomeChunk.swift diff --git a/ShhShell.xcodeproj/project.pbxproj b/ShhShell.xcodeproj/project.pbxproj index 9ead03a..c8c0748 100644 --- a/ShhShell.xcodeproj/project.pbxproj +++ b/ShhShell.xcodeproj/project.pbxproj @@ -83,6 +83,7 @@ A9921DE12E5F5710009F72A8 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9921DE02E5F5710009F72A8 /* WelcomeView.swift */; }; A994D64A2E5C94E200672395 /* ShaderTestingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A994D6492E5C94E200672395 /* ShaderTestingView.swift */; }; A9A2F4F62E3001D300D0AE9B /* AddSnippetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A2F4F52E3001D300D0AE9B /* AddSnippetView.swift */; }; + A9B1E5852E5F8E86009309E5 /* WelcomeChunk.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9B1E5842E5F8E86009309E5 /* WelcomeChunk.swift */; }; A9BA1D192E1D9AE1005BDCEF /* SwiftTerm.Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9BA1D182E1D9AE1005BDCEF /* SwiftTerm.Color.swift */; }; A9BA1D1E2E1EAD51005BDCEF /* SF-Mono-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = A9BA1D1C2E1EAD51005BDCEF /* SF-Mono-Bold.otf */; }; A9BA1D1F2E1EAD51005BDCEF /* SF-Mono-BoldItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = A9BA1D1D2E1EAD51005BDCEF /* SF-Mono-BoldItalic.otf */; }; @@ -225,6 +226,7 @@ A9921DE02E5F5710009F72A8 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = ""; }; A994D6492E5C94E200672395 /* ShaderTestingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShaderTestingView.swift; sourceTree = ""; }; A9A2F4F52E3001D300D0AE9B /* AddSnippetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSnippetView.swift; sourceTree = ""; }; + A9B1E5842E5F8E86009309E5 /* WelcomeChunk.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeChunk.swift; sourceTree = ""; }; A9BA1D182E1D9AE1005BDCEF /* SwiftTerm.Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftTerm.Color.swift; sourceTree = ""; }; A9BA1D1C2E1EAD51005BDCEF /* SF-Mono-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Mono-Bold.otf"; sourceTree = ""; }; A9BA1D1D2E1EAD51005BDCEF /* SF-Mono-BoldItalic.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SF-Mono-BoldItalic.otf"; sourceTree = ""; }; @@ -594,6 +596,7 @@ isa = PBXGroup; children = ( A9921DE02E5F5710009F72A8 /* WelcomeView.swift */, + A9B1E5842E5F8E86009309E5 /* WelcomeChunk.swift */, ); path = Onboarding; sourceTree = ""; @@ -891,6 +894,7 @@ A97AF1802E5D07BE00829443 /* CRTView.swift in Sources */, A9C897EF2DF1A9A400EF9A5F /* SSHHandler.swift in Sources */, A9D819312E102D8700442D38 /* HostkeysView.swift in Sources */, + A9B1E5852E5F8E86009309E5 /* WelcomeChunk.swift in Sources */, A98554552E05535F009051BD /* KeyManagerView.swift in Sources */, A9A2F4F62E3001D300D0AE9B /* AddSnippetView.swift in Sources */, A923172D2E07138000ECE1E6 /* SSHTerminalDelegate.swift in Sources */, diff --git a/ShhShell/Views/Onboarding/WelcomeChunk.swift b/ShhShell/Views/Onboarding/WelcomeChunk.swift new file mode 100644 index 0000000..a116dcf --- /dev/null +++ b/ShhShell/Views/Onboarding/WelcomeChunk.swift @@ -0,0 +1,52 @@ +// +// WelcomeChunk.swift +// ShhShell +// +// Created by neon443 on 27/08/2025. +// + +import SwiftUI + +struct WelcomeChunk: View { + @State var symbol: String + @State var title: String + @State var para: String + @State var timeTarget: TimeInterval = 0 + + @State private var spawnDate: Date = .now + + var body: some View { + TimelineView(.animation) { tl in + let time = tl.date.timeIntervalSince(spawnDate) + HStack { + if time > timeTarget { + Image(systemName: symbol) + .resizable().scaledToFit() + .frame(width: 50) + } + VStack(alignment: .leading) { + if time > timeTarget+1 { + Text(title) + .bold() + .font(.headline) + Text(para) + .foregroundStyle(.gray) + .multilineTextAlignment(.leading) + } + } + Spacer() + } + .animation(.spring, value: time) + .frame(maxWidth: .infinity) + .padding(.horizontal, 50) + } + } +} + +#Preview { + WelcomeChunk( + symbol: "trash", + title: "The Trash", + para: "Here's to the crazy ones." + ) +} diff --git a/ShhShell/Views/Onboarding/WelcomeView.swift b/ShhShell/Views/Onboarding/WelcomeView.swift index 9467cb5..cf2d1a5 100644 --- a/ShhShell/Views/Onboarding/WelcomeView.swift +++ b/ShhShell/Views/Onboarding/WelcomeView.swift @@ -8,11 +8,42 @@ import SwiftUI struct WelcomeView: View { - var body: some View { - Text("Welcome") - } + @State private var spawnDate: Date = .now + var body: some View { + TimelineView(.animation) { tl in + let time = tl.date.timeIntervalSince(spawnDate) +#if DEBUG + Button("reset") { spawnDate = .now } + Text("\(time)") + .frame(width: 150, alignment: .leading) +#endif + + VStack { + + Text("Welcome") + .monospaced() + .font(.largeTitle) + .bold() + + if time > 1 { + Image("regular") + .resizable().scaledToFit() + .frame(width: 100) + .clipShape(RoundedRectangle(cornerRadius: 22)) + .shadow(color: .white, radius: 6) + .transition(.scale) + .padding(.bottom) + } + if time > 1 { + WelcomeChunk(symbol: "hare.fill", title: "Blazing fast", para: "hi", timeTarget: 1) + } + } + .animation(.spring, value: time) + .preferredColorScheme(.dark) + } + } } #Preview { - WelcomeView() + WelcomeView() }