这是一个从上到下淡出图像的工作视图。如果有效的话,LMK!
源代码
struct ContentView: View {
var body: some View {
VStack {
Image("Explore")//Your Image
.resizable()
}
//We can use the LinearGradient in the mask modifier to fade it top to bottom
.mask(LinearGradient(gradient: Gradient(stops: [
.init(color: .black, location: 0),
.init(color: .clear, location: 1),
.init(color: .black, location: 1),
.init(color: .clear, location: 1)
]), startPoint: .top, endPoint: .bottom))
.padding()
.frame(width: 400, height: 400)
}
}
Run Code Online (Sandbox Code Playgroud)
预览
| 归档时间: |
|
| 查看次数: |
1306 次 |
| 最近记录: |