-
Notifications
You must be signed in to change notification settings - Fork 0
/
GradientsBootcamp.swift
73 lines (64 loc) · 2.12 KB
/
GradientsBootcamp.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
// GradientsBootcamp.swift
// SwiftfulThinkingBootcamp
//
// Created by enesozmus on 7.05.2024.
//
import SwiftUI
struct GradientsBootcamp: View {
let hueColors = stride(from: 0, to: 1, by: 0.01).map {
Color(hue: $0, saturation: 1, brightness: 1)
}
var body: some View {
Text("Rainbow")
.font(.largeTitle)
.foregroundStyle(
LinearGradient(
gradient: Gradient(colors: hueColors),
startPoint: .leading,
endPoint: .trailing
)
)
RoundedRectangle(cornerRadius: 25.0)
.fill(
.green.gradient
)
.frame(width: 300, height: 170)
RoundedRectangle(cornerRadius: 25.0)
.fill(
// .red
LinearGradient(
gradient: Gradient(colors: [Color.green, Color.black, Color.green]),
startPoint: .top,
endPoint: .bottomTrailing
)
)
.frame(width: 300, height: 170)
RoundedRectangle(cornerRadius: 25.0)
.fill(
RadialGradient(
// colors: [.red, .blue],
gradient: Gradient(colors: [Color.green, Color.black, Color.green]),
// center: .center,
center: .topLeading,
startRadius: 5.0,
endRadius: 200.0
)
)
.frame(width: 300, height: 170)
RoundedRectangle(cornerRadius: 25.0)
.fill(
AngularGradient(
colors: [.red, .blue],
//gradient: Gradient(colors: [Color.green, Color.black, Color.green]),
// center: .center,
center: .center,
angle: .degrees(4 + 45)
)
)
.frame(width: 300, height: 170)
}
}
#Preview {
GradientsBootcamp()
}