-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
186 lines (167 loc) · 4.67 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Piwo Piwo</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
/>
<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=Ubuntu+Condensed&display=swap"
rel="stylesheet"
/>
<style>
html {
margin: 0;
font-family: "Ubuntu Condensed", sans-serif;
}
body {
margin: 0;
background-color: #ffc444;
height: 100vh;
}
section {
text-align: center;
position: absolute;
font-size: 128px;
font-weight: 900;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
section:hover {
cursor: pointer;
}
header {
font-size: 32px;
font-weight: 900;
}
span {
padding: 0 16px 0 16px;
}
.piwo {
color: #927027;
position: fixed;
font-size: 48px;
left: 10px;
animation-name: example;
animation-duration: 2s;
animation-iteration-count: infinite;
animation-timing-function: ease-in;
}
.piwo:hover {
color: black;
}
@keyframes example {
from {
top: -40px;
}
to {
top: calc(100vh + 40px);
}
}
.noselect {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
footer {
position: fixed;
left: 8px;
bottom: 8px;
font-weight: 900;
}
section:active {
transition: font-size 0.1s;
font-size: 150px;
}
nav {
position: fixed;
left: 8px;
top: 8px;
color: black;
}
a {
text-decoration: none;
color: black;
font-weight: 900;
}
a:hover {
color: #927027;
}
</style>
</head>
<body>
<section class="noselect" id="piwo" onclick="add()">
<span><i class="fas fa-beer"></i></span>
<span id="points">0</span>
</section>
<footer class="noselect">
Created with love for <i class="fas fa-beer"></i>.
</footer>
<nav>
<a href="https://github.com/dsonyy/piwo-piwo">GitHub</a>
</nav>
</body>
<script>
var decimal_level = 10;
var counter = 0;
var adder = 1;
var base_color = [41, 100, 63];
var base_piwo_color = [41, 58, 36];
var piwo_new_color = 'hsl(41, 58%, 36%)';
function add() {
counter = counter + adder;
let points_element = document.getElementById("points");
points_element.innerHTML = counter;
check_possible_color_change();
addPiwo();
}
function check_possible_color_change() {
if (counter >= decimal_level) {
decimal_level += 1;
for(var i = 0; i < 3; i++){
if(base_color[i] - 3 >= 0)base_color[i] -= 0.4;
if(base_piwo_color[i] - 3 >= 0 ) base_piwo_color[i] -= 0.4;
}
//update piwo color value
piwo_new_color = 'hsl(' + base_piwo_color[0].toString(10) + ', ' +
base_piwo_color[1].toString(10) + '%, ' +
base_piwo_color[2].toString(10) + '%)'
//set the updated rgb value as a background color
document.body.style.backgroundColor =
'hsl(' + base_color[0].toString(10) + ', ' +
base_color[1].toString(10) + '%, ' +
base_color[2].toString(10) + '%)';
//make all the beers darker
let elements = document.getElementsByClassName('piwo');
for(var i = 0; i < elements.length; i++){
elements[i].style.color = piwo_new_color;
}
}
}
function addPiwo() {
const max = window.innerWidth - 32;
const min = 32;
const elem = document.createElement("div");
elem.innerHTML =
"<div class='piwo' style='left:" +
(Math.random() * (max - min) + min) +
"px; color:"+ piwo_new_color +"'><i class='fas fa-beer'></i></div>";
document.body.appendChild(elem);
}
</script>
</html>