Trying to use a View.shadow(...) function in SwiftUI to create a glow effect around an object in concert with the View.blend(.screen).
(尝试在SwiftUI中使用View.shadow(...)函数与View.blend(.screen)配合在对象周围创建发光效果。)
When I layer the objects without the shadow, they are the proper colors and blend properly:
(当我对没有阴影的对象进行分层时,它们是正确的颜色并正确混合:)
When I add the shadow, each object's shadow seems to blend with the object itself, shifting the colors:
(当我添加阴影时,每个对象的阴影似乎都与对象本身融合在一起,从而改变了颜色:)
Is there any way to have the shadow not blend with it's associated object?
(有什么办法可以使阴影不与其关联对象融合?)
Code snippit:
(代码段:)
Path(path1)
.foregroundColor(Color(color2))
.shadow(color: Color(color), radius: 5, x: 0, y: 0)
.blendMode(.screen)
Path(path2)
.foregroundColor(Color(color2))
.shadow(color: Color(color), radius: 5, x: 0, y: 0)
.blendMode(.screen)
ask by Spencer Connaughton translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…