Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alienator88 committed Oct 18, 2024
1 parent 94b1292 commit adc1462
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 32 deletions.
48 changes: 48 additions & 0 deletions Pearcleaner/Logic/Styles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,51 @@ func backgroundView(themeManager: ThemeManager = ThemeManager.shared, darker: Bo
}
}



struct GlowGradientButton: View {
// Define gradient colors for the button
let gradientColors = Gradient(colors: [.blue,.purple,.pink,.red,.blue])

// State variables to control animation and press state
@State var isAnimating = false
@State var isPressed = false

var body: some View {
ZStack{
// Background of the button with stroke, blur, and offset effects
RoundedRectangle(cornerRadius: 20)
.stroke(AngularGradient(gradient: gradientColors, center: .center, angle: .degrees(isAnimating ? 360 : 0)), lineWidth: 10)
.blur(radius: 30)
// .offset(y: 30) // Move the glow up or down
.frame(width: 230, height: 30)

// Text label for the button
Text(verbatim: "Hello")
.font(.system(size: 24))
.frame(width: 280, height: 60)
.background(.quinary.opacity(0.2), in: RoundedRectangle(cornerRadius: 20))
.foregroundStyle(.white)
.overlay(
// Overlay to create glow effect
RoundedRectangle(cornerRadius: 20)
.stroke(AngularGradient(gradient: gradientColors, center: .center, angle: .degrees(isAnimating ? 360 : 0)), lineWidth: 2)
)
}
// Scale effect when pressed
.scaleEffect(isPressed ? 0.95 : 1)
.animation(.easeInOut(duration: 0.2), value: isPressed)
.onAppear() {
// Animation to rotate gradient colors infinitely
withAnimation(.linear(duration: 3).repeatForever(autoreverses: false)) {
isAnimating = true
}
}
// Gesture to detect button press
.simultaneousGesture(
DragGesture(minimumDistance: 0)
.onChanged({_ in isPressed = true})
.onEnded({_ in isPressed = false})
)
}
}
40 changes: 8 additions & 32 deletions Pearcleaner/Views/RegularMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct RegularMode: View {
Spacer()
Group {
if appState.currentView == .empty || appState.currentView == .apps {
AppDetailsEmptyView(showPopover: $showPopover)
AppDetailsEmptyView()
} else if appState.currentView == .files {
FilesView(showPopover: $showPopover, search: $search)
.id(appState.appInfo.id)
Expand Down Expand Up @@ -139,47 +139,23 @@ struct RegularMode: View {


struct AppDetailsEmptyView: View {
@Environment(\.colorScheme) var colorScheme
@EnvironmentObject var appState: AppState
@EnvironmentObject var locations: Locations
// @AppStorage("settings.general.animateLogo") private var animateLogo: Bool = true
@Binding var showPopover: Bool
// @State private var animationStart = false
// @Environment(\.colorScheme) var colorScheme
// @EnvironmentObject var appState: AppState
// @EnvironmentObject var locations: Locations
// @Binding var showPopover: Bool

var body: some View {
VStack(alignment: .center) {

Spacer()

PearDropView()
// if #available(macOS 14, *) {
// if animateLogo && animationStart {
// PearDropView()
// .phaseAnimator([false, true]) { wwdc24, chromaRotate in
// wwdc24
// .hueRotation(.degrees(chromaRotate ? 420 : 0))
// } animation: { chromaRotate in
// .easeInOut(duration: 6)
// }
// } else {
// PearDropView()
// }
//
// } else {
// PearDropView()
// }

// GlowGradientButton()

Spacer()

// Text("Drop an app here")
// .font(.title3)
// .padding(.bottom, 25)
// .opacity(0.5)
}
// .onAppear {
// DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
// animationStart = true
// }
// }

}
}

0 comments on commit adc1462

Please sign in to comment.