-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathoutro.html
More file actions
205 lines (170 loc) · 6.58 KB
/
outro.html
File metadata and controls
205 lines (170 loc) · 6.58 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="styles/styles.css">
<title>Outro</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inconsolata&display=swap" rel="stylesheet">
<style>
div {
/* we could even change this according to the background they pick */
/* background-color: white; */
padding: 15px;
margin: 30px;
width: 400px;
}
.cakeCanvas {
padding: 0;
margin-left: 340px;
margin-top: -450px;
border: none;
}
body {
margin-left: 330px;
margin-top: 120px;
}
</style>
<script src = "changebg.js" type = "text/javascript"></script>
<script src = "index.js" type = "text/javascript"></script>
</head>
<body id="body" style="background-color:#c5d6e6">
<script type="text/javascript">
// CHANGING BACKGROUND
bg--;
changeBg();
// SENDING EMAIL
function getEmail() {
var input = document.getElementById("email");
const email = input.value;
console.log("hi");
console.log(email);
sendEmail(email);
}
function sendEmail(emailinput) {
console.log("send email button pushed")
window.open("mailto:" + emailinput + "?subject=Play%20Make%20a%20Cake! &body=You should play this game made by Sophia, Sylvia, JJ, and Juna: https://github.com/lejubi/MakeACake");
}
</script>
<!-- placeholder items -->
<div style="display: none">
<img id="cake" src="img/vanilla_cake.png"/>
<img id="frosting" src="img/nothing.png"/>
<img id="topping" src="img/nothing.png"/>
</div>
<div>
<script src = "changePage.js"></script>
<button class = "button pinkButton remakeButton" onclick="goToIndex()">Remake your cake</button>
</div>
<div>
<!-- SHARING CAKE HTML -->
<h1 class = "saveYourCake">Save Your Cake!</h1>
<h3>Share this game:</h3>
<form autocomplete = "on" >
<label for="email">Email: </label>
<input type="text" name="email" id="email">
<button name="submit" class = "button purpleButton" id="submit" onclick = "getEmail(); clickOpSound.play();">Share</button>
</form>
<br>
<br>
<br>
<br>
<button type = "button" class = "button greenButton" id="downloadBtn" onclick="downloadCanvas(); clickOpSound.play();"> Download your cake</button>
</div>
<div class="cakeCanvas">
<canvas id="cakeSlice" width="500" height="500"></canvas>
</div>
<script type = "text/javascript">
var canvas = document.getElementById("cakeSlice");
function downloadCanvas() {
console.log("download button pressed");
var link = document.createElement('a');
link.download = 'yourCake.png';
console.log(link);
link.href = canvas.toDataURL("image/png");
console.log(link);
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
cakeChoice = localStorage.getItem("cakeChoice");
frostingChoice = localStorage.getItem("frostingChoice");
toppingChoice = localStorage.getItem("toppingChoice");
const c = document.getElementById("cakeSlice");
const ctx = c.getContext("2d");
console.log("cake choice: " + cakeChoice);
console.log("frosting choice: " + frostingChoice);
console.log("topping choice: " + toppingChoice);
cakeChoice = parseInt(cakeChoice);
frostingChoice = parseInt(frostingChoice);
toppingChoice = parseInt(toppingChoice);
console.log("cake choice: " + typeof cakeChoice);
console.log("frosting choice: " + typeof frostingChoice);
console.log("topping choice: " + typeof toppingChoice);
var cakeFlavor;
if (cakeChoice == 1){
cakeFlavor = document.getElementById('cake');
cakeFlavor.src = "img/vanilla_slice.png"
}
else if (cakeChoice == 2){
cakeFlavor = document.getElementById('cake');
cakeFlavor.src = "img/chocolate_slice.png";
}
else if (cakeChoice == 3){
cakeFlavor = document.getElementById('cake');
cakeFlavor.src = "img/strawberry_slice.png";
}
var frosting;
if (frostingChoice == 0){
frosting = document.getElementById('frosting');
frosting.src = "img/nothing.png"
}
if (frostingChoice == 1){
frosting = document.getElementById('frosting');
frosting.src = "img/frosting1_slice.png"
}
else if (frostingChoice == 2){
frosting = document.getElementById('frosting');
frosting.src = "img/frosting2_slice.png";
}
else if (frostingChoice == 3){
frosting = document.getElementById('frosting');
frosting.src = "img/frosting3_slice.png";
}
var topping;
console.log(toppingChoice);
if (toppingChoice == 0){
topping = document.getElementById('topping');
topping.src = "img/nothing.png";
}
else if (toppingChoice == 1){
topping = document.getElementById('topping');
topping.src = "img/topping1_slice.png";
}
else if (toppingChoice == 2){
console.log("vgyujhbknlkm")
topping = document.getElementById('topping');
topping.src = "img/topping2_slice.png";
}
else if (toppingChoice == 3){
topping = document.getElementById('topping');
topping.src = "img/topping3_slice.png";
}
else if (toppingChoice == 4){
topping = document.getElementById('topping');
topping.src = "img/topping4_slice.png";
}
else if (toppingChoice == 5){
topping = document.getElementById('topping');
topping.src = "img/topping5_slice.png";
}
topping.addEventListener("load", (e) => {
ctx.drawImage(cakeFlavor,10,10,500,500);
ctx.drawImage(frosting,10,10,500,500);
ctx.drawImage(topping,10,10,500,500);
})
</script>
</body>
</html>