Skip to content

Commit

Permalink
Fix Demo for iOS 17
Browse files Browse the repository at this point in the history
  • Loading branch information
buh committed Oct 2, 2023
1 parent 388a86b commit fae86b7
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Demo/Hubble/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,25 @@ struct ContentView: View {

@ViewBuilder
private func stars() -> some View {
GeometryReader { proxy in
let w = max(proxy.size.width, proxy.size.height)

ForEach(0...100, id: \.self) { _ in
let s = CGFloat(Int.random(in: 10...30)) / 10
let o = Double(Int.random(in: 30 ... 100)) / 100
ZStack {
GeometryReader { proxy in
let w = max(proxy.size.width, proxy.size.height)

Circle()
.fill(Color.white.opacity(o))
.frame(width: s, height: s)
.offset(x: CGFloat.random(in: 0...w), y: CGFloat.random(in: 0...w))
.shadow(color: Color.white.opacity(o), radius: 2 * s)
ForEach(0...100, id: \.self) { _ in
let s = CGFloat(Int.random(in: 10...30)) / 10
let o = Double(Int.random(in: 30 ... 100)) / 100

Circle()
.fill(Color.white.opacity(o))
.frame(width: s, height: s)
.offset(x: CGFloat.random(in: 0...w), y: CGFloat.random(in: 0...w))
.shadow(color: Color.white.opacity(o), radius: 2 * s)
}
}
}
.drawingGroup()
.rotationEffect(starsRotation)
.onAppear {
.task {
withAnimation(.linear(duration: 60).repeatForever(autoreverses: false)) {
starsRotation = .degrees(360)
}
Expand Down

0 comments on commit fae86b7

Please sign in to comment.