Skip to content

Commit

Permalink
fix radius
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Mar 13, 2020
1 parent 21c305a commit d264808
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DemoApp/DemoApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ struct ContentView: View {

struct ContentView_Previews: PreviewProvider {
static let neumorphism = NeumorphismManager(
isDark: true,
isDark: false,
lightColor: Color(hex: "C1D2EB"),
darkColor: Color(hex: "2C292C")
darkColor: Color(hex: "131A20")
)

static var previews: some View {
Expand Down
8 changes: 5 additions & 3 deletions Sources/Modifier/NeumorphismShadowModifier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public struct NeumorphismShadowModifier: ViewModifier {
private let x: CGFloat
private let y: CGFloat

public init(darkShadowColor: Color? = nil, lightShadowColor: Color? = nil, radius: CGFloat = 16, x: CGFloat = 9, y: CGFloat = 9, isAnimation: Bool = false) {
public init(darkShadowColor: Color? = nil, lightShadowColor: Color? = nil, radius: CGFloat = 8, x: CGFloat = 8, y: CGFloat = 8, isAnimation: Bool = false) {
self.darkShadowColor = darkShadowColor
self.lightShadowColor = lightShadowColor
if isAnimation {
Expand All @@ -30,11 +30,13 @@ public struct NeumorphismShadowModifier: ViewModifier {
content
.shadow(
color: darkShadowColor ?? neumorphism.color.darkerColor(),
radius: radius, x: x, y: y
radius: radius,
x: x, y: y
)
.shadow(
color: lightShadowColor ?? neumorphism.color.lighterColor(),
radius: radius, x: -x, y: -y
radius: radius,
x: -x, y: -y
)
}
}

0 comments on commit d264808

Please sign in to comment.