Skip to content

graddotdev/SwiftUI-NeoShadow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NeoShadow

NeoShadow is a Swift package that provides advanced shadow effects for SwiftUI shapes.

Credits

This package is a SwiftUI implementation inspired by the Beautiful Shadows Figma plugin by Alex Widua. The shadow generation algorithm and layer calculations are based on his excellent work.

Examples

NeoShadow supports two shadow styles - inner and drop shadows. Each can be fully customized using the following parameters.

Code Preview
let shape = RoundedRectangle(
  cornerRadius: 16,
  style: .continuous
)

shape
  .fill(.white)
  .frame(width: 200, height: 200)
  .overlay {
    shape
      .neoShadow(
        style: .inner,
        color: .black,
        brightness: 0.05,
        elevation: 0.10,
        azimuth: .degrees(60),
        distance: 120,
        layerCount: 6
      )
  }
let shape = RoundedRectangle(
  cornerRadius: 16,
  style: .continuous
)

shape
  .fill(.white)
  .frame(width: 200, height: 200)
  .background {
    shape
      .neoShadow(
        style: .drop,
        color: .black,
        brightness: 0.10,
        elevation: 0.10,
        azimuth: .degrees(60),
        distance: 120,
        layerCount: 6
      )
  }

Parameters

  • style: Shadow style: .inner or .drop, defaults to .drop
  • color: Shadow base color, defaults to .black
  • brightness: Controls shadow intensity from 0.0 to 1.0, defaults to 0.1
  • elevation: Determines shadow depth from 0.0 to 1.0, defaults to 0.15
  • azimuth: Light source angle, defaults to .degrees(60)
  • distance: Distance from the light source to the surface, defaults to 120
  • layerCount: Number of shadow layers for depth effect, defaults to 6

License

This project is available under the MIT license. See the LICENSE file for more info.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published