0
下午好,將模糊陰影添加到圓圈
我如何在swift 3中實現這樣的效果?
circle with blurred drop shadow beneath
陰影的中心大約是從圓的底部30像素。我曾嘗試過使用陰影技巧,但我無法擠壓陰影。我也嘗試使用photoshop中的圖片,但是放大時模糊會變得非常糟糕。
下午好,將模糊陰影添加到圓圈
我如何在swift 3中實現這樣的效果?
circle with blurred drop shadow beneath
陰影的中心大約是從圓的底部30像素。我曾嘗試過使用陰影技巧,但我無法擠壓陰影。我也嘗試使用photoshop中的圖片,但是放大時模糊會變得非常糟糕。
let rect = CGRect(x: 0, y: midView.frame.minY, width: (midView.bounds.width), height: 20.0)
let elipticalPath = UIBezierPath(ovalIn: rect).cgPath
let maskLayer = CAGradientLayer()
maskLayer.frame = midView.bounds
maskLayer.shadowRadius = 15
maskLayer.shadowPath = elipticalPath
maskLayer.shadowOpacity = 0.7
maskLayer.shadowOffset = CGSize.zero
maskLayer.shadowColor = UIColor.gray.cgColor
midView.layer.addSublayer(maskLayer)
[在IOS陰影]的可能的複製(https://stackoverflow.com/questions/40155443/drop-shadow-in-ios) –
我建議(1發現)或(2創建)應用了高斯模糊效果的橢圓圖像並將其放置在圓/下的UIImageView中。 1)只是谷歌橢圓高斯模糊PNG。 2)使用Photoshop以外的其他程序來創建圖像,例如親和設計師/ gimp/illustrator /其他一些程序。然後根據需要調整Alpha值。 –
@Tarvo您的重複幫助回答了問題 – user3483586