Border Beam

Border Beam

A glowing beam of light that travels around any rounded-rect or capsule border, with a tapered gradient tail and bloom. One modifier, configurable colors, speed, length and beam count.

Luiz Mello
  • border
  • animation
  • gradient

snippet.swift213 lines

4 files • Scroll to see all →
/// Configuration for `.borderBeam(...)`.public struct BorderBeamStyle {    /// Colors from the beam's head to its tail.    public var colors: [Color]    /// Seconds per lap.    public var duration: Double    /// Beam length as a fraction of the perimeter (0...1).    public var length: CGFloat    public var lineWidth: CGFloat    /// Blur radius of the bloom around the beam.    public var glow: CGFloat    /// Number of evenly spaced beams chasing each other.    public var beamCount: Int    public var reversed: Bool    /// Start offset of the first beam, as a fraction of a lap.    public var offset: Double    /// Faint static border underneath the beam.    public var showsTrack: Bool​    public init(​// ... (click "Show full code" to see more)
Viewing: BorderBeam.swift•1 of 4