LinearGradient
RadialGradient (방사형)
AngularGradient (conic_원뿔형)
// Created by Toughie on 2023/04/02.
//
import SwiftUI
struct Gradients: View {
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: 25)
.fill(
LinearGradient(
gradient: Gradient(colors: [Color.white,Color.red,Color.orange, Color.blue, Color.green]),
startPoint: .topLeading,
endPoint: .bottomTrailing)
)
.fill(
RadialGradient(
gradient: Gradient(colors: [Color.red, Color.blue]),
center: .topLeading, //endPoint
startRadius: 5,
endRadius: 400)
)
.fill(
AngularGradient(
gradient: Gradient(colors: [Color.red,Color.blue]),
center: .center,
angle: .degrees(180 + 60))
)
.shadow(color: .blue, radius: 10, x: 0, y: 0)
.frame(width: 300, height: 300)
Text("Hello SwiftUI")
.font(.largeTitle)
.foregroundColor(.white)
.fontWeight(.bold)
}
}
struct Gradients_Previews: PreviewProvider {
static var previews: some View {
Gradients()
}
}
}
오우.. 그라데이션 너무 재밌다.
'SwiftUI > SwiftUI(Basic)' 카테고리의 다른 글
5. [SwiftUI] Image() 이미지 삽입 (0) | 2023.04.03 |
---|---|
4. [SwiftUI] System Icons 시스템 아이콘 (0) | 2023.04.02 |
2. [SwiftUI] Color() 컬러 (0) | 2023.04.02 |
1. [SwiftUI] Shapes 도형 (0) | 2023.04.02 |
0. [SwiftUI] Text() - 텍스트 (0) | 2023.03.28 |