Dot Grid Spotlight

Dot Grid Spotlight

An interactive dot-pattern background drawn in a single Canvas: dots under your finger swell, glow and get pushed aside like a lens, while an idle wave keeps the grid breathing. Apply it to any screen with one modifier.

Luiz Mello
  • interactive
  • gesture
  • gradient

snippet.swift263 lines

4 files • Scroll to see all →
/// Appearance of a dot grid spotlight background.public struct DotGridSpotlightStyle {    /// Distance between dots, in points.    public var spacing: CGFloat    /// Resting radius of each dot.    public var dotRadius: CGFloat    /// Reach of the finger spotlight.    public var spotlightRadius: CGFloat    /// How much a dot right under the finger grows.    public var maxScale: CGFloat    /// Glow color at the edge of the spotlight.    public var tint: Color    /// Glow color at the center of the spotlight.    public var coreTint: Color    /// Strength of the idle diagonal "breathing" wave (0 disables it).    public var waveAmplitude: CGFloat    /// Resting dot color. `nil` adapts to light / dark mode.    public var dotColor: Color?​    public init(​// ... (click "Show full code" to see more)
Viewing: DotGridSpotlight.swift•1 of 4