struct ContentView: View {
var body: some View {
VStack {
// 绘制线性渐变
Text("sc.i0905.com")
.font(.system(size: 45))
.padding()
.foregroundColor(.white)
.background(
// LinearGradient(colors: [.orange,.red,.purple], startPoint: .topLeading, endPoint: .bottomTrailing)//线性渐变
LinearGradient(colors: [.orange, .red, .purple], startPoint: .bottomTrailing, endPoint: .topLeading) // 线性渐变
)
// 角度渐变制作顺时针的扇形渐变颜色
Text("sc.i0905.com")
.font(.system(size: 45))
.padding()
.foregroundColor(.white)
.background(
// AngularGradient(gradient: Gradient(colors: [.orange,.red,.purple]), center: UnitPoint(x: 0.5, y: 0.5))//角度渐变,渐变的中心点位于文本视图的中心位置
// AngularGradient(gradient: Gradi
SwiftUI初级课程(二十二)线性、角度、径向渐变
最新推荐文章于 2024-10-08 10:25:28 发布
本文深入探讨了SwiftUI中如何创建和应用线性渐变和角度径向渐变,包括颜色选择、方向设置以及在iOS界面设计中的实践技巧。
摘要由CSDN通过智能技术生成