-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathIcon.swift
81 lines (73 loc) · 2.86 KB
/
Icon.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
74
75
76
77
78
79
80
81
//
// Icon.swift
//
// Created by Zac White.
// Copyright © 2020 Velos Mobile LLC / https://velosmobile.com / All rights reserved.
//
import SwiftUI
import SwiftUIcon
struct Icon: View {
var body: some View {
/// Note: All of these assume a canvas size of 1024.
let spacing: CGFloat = 80
let radius: CGFloat = 135
let pillLength: CGFloat = 350
let pillRotation: Angle = .degrees(30)
let circleOffsetX: CGFloat = 50
let circleOffsetY: CGFloat = 20
let velosBackground = Color(red: 0/256, green: 180/256, blue: 185/256)
let velosPrimary = Color.white
let velosSecondary = Color(red: 248/256, green: 208/256, blue: 55/256)
return IconStack { canvas in
velosBackground
.edgesIgnoringSafeArea(.all)
HStack(alignment: .center, spacing: canvas[spacing]) {
HStack(alignment: .top, spacing: canvas[spacing]) {
Circle()
.fill(velosPrimary)
.frame(width: canvas[radius], height: canvas[radius])
.offset(x: canvas[circleOffsetX], y: canvas[circleOffsetY])
RoundedRectangle(cornerRadius: canvas[radius])
.fill(velosPrimary)
.frame(width: canvas[radius], height: canvas[pillLength])
.rotationEffect(pillRotation)
}
HStack(alignment: .bottom, spacing: canvas[spacing]) {
RoundedRectangle(cornerRadius: canvas[radius])
.fill(velosSecondary)
.frame(width: canvas[radius], height: canvas[pillLength])
.rotationEffect(pillRotation)
RoundedRectangle(cornerRadius: canvas[radius])
.fill(velosSecondary)
.frame(width: canvas[radius], height: canvas[pillLength])
.rotationEffect(pillRotation)
Circle()
.fill(velosSecondary)
.frame(width: canvas[radius], height: canvas[radius])
.offset(x: -canvas[circleOffsetX], y: -canvas[circleOffsetY])
}
}
}
}
}
#if DEBUG
struct Icon_Previews : PreviewProvider {
static var previews: some View {
Group {
Icon()
.previewIcon()
.previewLayout(.sizeThatFits)
Icon()
.previewHomescreen()
.background(
LinearGradient(
gradient: Gradient(colors: [.purple, .orange]),
startPoint: .bottom,
endPoint: .top
)
)
.previewLayout(.fixed(width: 500, height: 500))
}
}
}
#endif