Skip to content

Instantly share code, notes, and snippets.

@MojtabaHs
Created December 3, 2025 07:24
Show Gist options
  • Select an option

  • Save MojtabaHs/f0083b1c96093aed1dba7ea03aaef701 to your computer and use it in GitHub Desktop.

Select an option

Save MojtabaHs/f0083b1c96093aed1dba7ea03aaef701 to your computer and use it in GitHub Desktop.
Reddit - SwiftUI - Comments - 1oimat1
import SwiftUI
struct Reddit: View {
@State private var triggered = false
func content() -> some View {
VStack(alignment: .leading, spacing: 16) {
Text("October 23")
.font(.caption)
.foregroundStyle(.secondary)
Text("Embrace the unexpected, a bold step in a new direction ignites your path to greatness")
Button("Generate", systemImage: "sparkles") { }
.buttonStyle(.bordered)
.buttonBorderShape(.circle)
}
.labelStyle(.iconOnly)
.foregroundStyle(.black)
.frame(maxWidth: .infinity)
.padding()
.padding(.vertical, 8)
.background(in: .rect(cornerRadius: 32))
.padding()
}
var body: some View {
ZStack {
RadialGradient(
colors: [.orange, .orange.opacity(0)],
center: .center,
startRadius: 0,
endRadius: triggered ? 700 : 0
)
.ignoresSafeArea()
card()
}
.animation(.default, value: triggered)
.overlay(alignment: .bottom) {
Button("Go") { triggered.toggle() }
}
}
func card() -> some View {
content()
.rotation3DEffect(.degrees(triggered ? 0 : 90), axis: (x: 1, y: 0, z: 0))
.rotation3DEffect(.degrees(triggered ? 0 : 10), axis: (x: 1, y: 1, z: 0))
.scaleEffect(triggered ? 1 : 0)
.blur(radius: triggered ? 0 : 10)
.animation(.spring.speed(0.5).delay(0.5), value: triggered)
}
}
#Preview {
Reddit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment