-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProfile.swift
More file actions
134 lines (111 loc) · 4.56 KB
/
Profile.swift
File metadata and controls
134 lines (111 loc) · 4.56 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
//
// Profile.swift
// Happy Tree
//
// Created by Thach Quynh Anh on 11/6/22.
//
import Foundation
import SwiftUI
struct Profile: View{
@State var selectedTab: Int = 0
let background = Color(red: 1, green: 0.90, blue: 1.0)
init() {
UITabBar.appearance().backgroundColor = UIColor.white
}
var body: some View {
TabView(selection: $selectedTab){
YourSoulTree()
.tabItem {
Image(systemName: "leaf")
Text("Your Tree")
}
.tag(0)
DiaryTotal()
.tabItem {
Image(systemName: "note.text")
Text("Your Diary")
}
.tag(1)
FriendList()
.tabItem {
Image(systemName: "person.3.sequence.fill")
Text("Friends List")
}
.tag(2)
AskingQuestion()
.tabItem {
Image(systemName: "person.fill.questionmark")
Text("Your Feeling")
}
.tag(3)
}
.accentColor(Color.purple)
}
struct YourSoulTree: View{
@State var isAnimated: Bool = false
@State private var animateLeaf1 = false
// @State var addLeaf: Int = 0
var body: some View{
NavigationView {
ZStack {
Color(red: 1, green: 0.90, blue: 1.0)
.ignoresSafeArea()
VStack{
// Button(action: {SoundManager.instance.playSound()}){
// Image(systemName: "speaker")
// }
Button("Click here to see how your soul tree has changed"){
withAnimation(.default){
isAnimated.toggle()
}
}
.font(.system(size: 20, design: .rounded))
.fontWeight(.semibold)
.padding()
.kerning(1.2)
.frame(width: 320, height: 110)
.multilineTextAlignment(.center)
.background(Color.white)
.cornerRadius(15)
.foregroundColor(Color.purple)
Image("yourSoulTree 2")
.frame(width: 550, height: 550)
.onTapGesture {
withAnimation(Animation.spring(response: 0.1, dampingFraction: 0.4, blendDuration: 3).speed(0.3).repeatForever(autoreverses: false)){
animateLeaf1.toggle()
}
}
}
.padding(.top)
Image("add-leaf2")
.offset(x: isAnimated ? 10 : -500, y: isAnimated ? 15 : -500)
.offset(x: animateLeaf1 ? 10 : 12, y: animateLeaf1 ? 15 : 18)
Image("add-leaf1")
.offset(x: animateLeaf1 ? -43 : -45, y: animateLeaf1 ? 53 : 55)
Image("add-leaf3")
.offset(x: animateLeaf1 ? 71 : 74, y: animateLeaf1 ? 34 : 36)
Image("add-leaf1")
.offset(x: animateLeaf1 ? 120 : 113, y: animateLeaf1 ? 100 : 102)
Image("add-leaf2")
.offset(x: animateLeaf1 ? 157 : 160, y: animateLeaf1 ? 108 : 110)
NavigationLink(destination: OldBasket()){
ZStack{
Image("basket1")
.padding(.top, 500)
.padding(.trailing, -8000)
.padding(.maximum(10, -40))
}
}
}
}.navigationViewStyle(StackNavigationViewStyle())
}
struct Profile_Previews: PreviewProvider {
static var previews: some View {
NavigationView{
Profile()
}
.environmentObject(ListViewModel())
}
}
}
}