
Meteor Shower
Angled shooting stars with glowing heads and gradient tails streak over a twinkling star field. Every meteor is a seeded function of time, so it runs in one Canvas with zero per-frame state.
- animation
- motion
- gradient
snippet.swift202 lines
5 files • Scroll to see all →
/// A night-sky background: angled shooting stars with glowing heads and/// gradient tails streak across a softly twinkling star field.////// Everything is drawn in a single `Canvas` and every meteor is a pure/// function of time (seeded randomness), so there is no per-frame state.public struct MeteorShower: View { var meteorCount: Int var starCount: Int var direction: Angle var flightDuration: ClosedRange<Double> var interval: ClosedRange<Double> var tailLength: ClosedRange<CGFloat> var color: Color? var glow: Color var seed: UInt64 @Environment(\.colorScheme) private var colorScheme @Environment(\.accessibilityReduceMotion) private var reduceMotion /// - Parameters:// ... (click "Show full code" to see more)Viewing: MeteorShower.swift•1 of 5