-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainMenu.swift
More file actions
64 lines (58 loc) · 1.74 KB
/
MainMenu.swift
File metadata and controls
64 lines (58 loc) · 1.74 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
//
// MainMenu.swift
// WWDC24
//
// Created by Gustavo Binder on 25/02/24.
//
import SwiftUI
struct MainMenu: View {
@EnvironmentObject var sceneManager : SceneManager
@State var off1 : CGFloat = -1000
@State var off2 : CGFloat = 1000
@State var visible : Bool = false
var body: some View {
ZStack {
VStack {
Image("AllPolaroids1")
.offset(y: off1)
Image("AllPolaroids2")
.offset(y: off2)
}
VStack {
Image("HiddenText")
.padding(100)
.scaleEffect(CGSize(width: visible ? (1) : (0), height: visible ? (1) : (0)))
.transition(.opacity)
Image("MittMaje")
.scaleEffect(CGSize(width: visible ? (1.5) : (0), height: visible ? (1.5) : (0)))
.transition(.scale)
.padding()
Button {
sceneManager.change_to_intro()
} label: {
ZStack {
Image("Paper")
Text("Go to Intro")
.font(.largeTitle)
.foregroundStyle(.black)
}
}
.padding(100)
.offset(y: off2 + 100)
}
}
.background(.black)
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
withAnimation(.easeInOut(duration: 0.5)) {
off1 = 100
off2 = -100
visible = true
}
})
}
}
}
#Preview {
MainMenu()
}