-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
executable file
·429 lines (429 loc) · 15 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="Interactive Breathing Bubble inspired by https://www.wimhofmethod.com/breathing-techniques">
<meta name="keywords" content="Interactive, Breathing, Bubble, Interactive Breathing, Interactive Breathing Bubble, Wim, Hof, Wim Hof">
<meta name="author" content="Weedshaker">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" sizes="57x57" href="./img/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="./img/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="./img/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="./img/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="./img/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="./img/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="./img/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="./img/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="./img/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="./img/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="./img/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="./img/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="./img/favicon-16x16.png">
<link rel="manifest" href="manifest.json">
<meta name="msapplication-TileColor" content="#0d3b68">
<meta name="msapplication-TileImage" content="./img/ms-icon-144x144.png">
<meta name="theme-color" content="#0d3b68">
<link rel="preload" href="./sound/breath.mp3" as="audio">
<!--<link rel="preload" href="./sound/finishing.mp3" as="audio">-->
<link rel="preload" href="./sound/TreeofLifeBasicTrack.mp3" as="audio">
<link rel="preload" href="./sound/littleGong.mp3" as="audio">
<link rel="preload" href="./sound/longGong.mp3" as="audio">
<title>Interactive Breathing Bubble 😎🤙</title>
</head>
<body>
<!-- link rel="preload" as="audio" is unsupported, trying to trigger the browser here to preload -->
<!-- preferably use this sounds, trying to have mobile unlock and keep these sounds unlock -->
<audio id=breath hidden=true src="./sound/breath.mp3"></audio>
<!--<audio id=finishing hidden=true src="./sound/finishing.mp3"></audio>-->
<audio id=finishing hidden=true src="./sound/TreeofLifeBasicTrack.mp3"></audio>
<audio id=littleGong hidden=true src="./sound/littleGong.mp3"></audio>
<audio id=longGong hidden=true src="./sound/longGong.mp3"></audio>
<!-- /link rel="preload" as="audio" is unsupported, trying to trigger the browser here to preload -->
<c-wake-lock info>
<c-local-storage>
<c-router mode=hash routes="[
{
'name': 'breathing-bubble',
'path': '../../components/pages/BreathingBubble.js',
'regExp': ['/^#\/$/', '/^#\/breathing/'],
'attributes': {
'info': ''
}
},
{
'name': 'retention-time',
'path': '../../components/pages/RetentionTime.js',
'regExp': '/^#\/retention/'
},
{
'name': 'recovery-breath',
'path': '../../components/pages/RecoveryBreath.js',
'regExp': '/^#\/recovery/'
},
{
'name': 'result-overview',
'path': '../../components/pages/ResultOverview.js',
'regExp': '/^#\/result/'
},
{
'name': 'further-instructions-iframe',
'path': '../../components/pages/FurtherInstructionsIframe.js',
'regExp': '/^#\/instructions-iframe/'
},
{
'name': 'further-instructions',
'path': '../../components/pages/FurtherInstructions.js',
'regExp': '/^#\/instructions/'
}
]"></c-router>
</c-local-storage>
</c-wake-lock>
<script rel=preload type=module>
import('./event-driven-web-components-prototypes/src/controllers/WakeLock.js').then(module => {
if (!customElements.get('c-wake-lock')) customElements.define('c-wake-lock', module.default)
})
import('./components/controllers/LocalStorage.js').then(module => {
if (!customElements.get('c-local-storage')) customElements.define('c-local-storage', module.default)
})
import('./event-driven-web-components-router/src/Router.js').then(module => {
if (!customElements.get('c-router')) customElements.define('c-router', module.default)
})
self.Environment = {
mobileBreakpoint: '600px'
}
// Service Worker
navigator.serviceWorker.register('MasterServiceWorker.js', { scope: './' }).then(registration => {
Notification.requestPermission(result => {
if (result === "granted") {
registration.active.postMessage('visible')
document.addEventListener('visibilitychange', event => registration.active.postMessage(document.visibilityState))
}
})
registration.update()
}).catch(error => console.error(error))
// iphone fix, which would always keep other sounds locked, if not unlocked through user interaction
// here grab first user interaction and unlock all audio elements by playing them, later make sure to only use already unlocked elements directly in document body
document.body.addEventListener('click', event => {
Array.from(document.querySelectorAll('audio')).forEach(audio => {
if (audio.paused) {
audio.play()
audio.pause()
}
})
}, { once: true })
</script>
<style>
:root {
--theme-color: #f9e5b0;
--background-color: #0d3b68;
color: var(--theme-color);
background-color: var(--background-color);
font-family:'Courier New', Courier, monospace;
font-size: clamp(10px, 1vw, 16px);
}
body {
margin: 0;
padding: 0;
}
</style>
<!-- Background -->
<div class=bg>
<div class="datouwang">
<div class="arms">
<div class="arm" style="--scaleX:1;--scaleY:1;--rotate:3;"></div>
<div class="arm" style="--scaleX:1;--scaleY:1.1;--rotate:2;"></div>
<div class="arm" style="--scaleX:1;--scaleY:1.2;--rotate:1;"></div>
<div class="arm" style="--scaleX:-1;--scaleY:1.15;--rotate:0;"></div>
<div class="arm" style="--scaleX:-1;--scaleY:1.1;--rotate:0;"></div>
<div class="arm" style="--scaleX:-1;--scaleY:1;--rotate:-1;"></div>
<div class="arm" style="--scaleX:-1;--scaleY:1.15;--rotate:-2;"></div>
<div class="arm" style="--scaleX:.5;--scaleY:1.15;--rotate:-3;"></div>
</div>
<div class="tentacles">
<div class="tentacle"></div>
<div class="tentacle"></div>
<div class="tentacle"></div>
<div class="tentacle"></div>
<div class="tentacle"></div>
</div>
<div class="guts"></div>
<div class="body">
<div class="base"></div>
</div>
</div>
</div>
<style>
@keyframes swim {
20% {
transform: translateY(3em);
}
45% {
transform: translateY(-3em);
}
100% {
transform: translateY(3em);
}
}
@keyframes squash {
20% {
transform: scaleY(0.9);
}
40% {
transform: scaleY(1.1);
}
60% {
transform: scaleY(0.9);
}
}
@keyframes wave {
30% {
transform: scaleX(var(--scaleX)) scaleY(var(--scaleY)) rotate(calc(var(--rotate) * -1deg));
}
}
.bg {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
z-index: -1;
opacity: 0.5;
}
.datouwang {
position: absolute;
filter: drop-shadow(0 0 1em cyan);
transform-origin: 50% 0;
transform: translateY(3em);
width: 200px;
}
.datouwang:not(.no-swim) {
animation: swim 25s ease-in-out infinite;
will-change: transform;
}
.datouwang .arms {
transform-origin: 50% 0;
animation: squash 25s ease-in-out infinite;
will-change: transform;
}
.datouwang .arms .arm {
position: absolute;
width: 2em;
height: 6em;
top: 3em;
border-radius: 50%;
border-left: 1em solid #ccffff;
border-bottom: 0.3em solid transparent;
transform-origin: 50% 0;
opacity: 0.4;
transform: scaleX(var(--scaleX)) scaleY(var(--scaleY)) rotate(calc(var(--rotate) * 1deg));
animation: wave 25s ease-in-out infinite;
will-change: transform;
}
.datouwang .arms .arm:before {
content: '';
position: absolute;
width: 1.6em;
height: 3em;
top: 5.1em;
left: -1.5em;
border-radius: 50%;
border-right: 0.6em solid #ccffff;
border-top: 0.3em solid transparent;
border-bottom: 0.3em solid transparent;
transform: rotate(-10.4deg);
}
.datouwang .arms .arm:after {
content: '';
position: absolute;
width: 1em;
height: 2em;
top: 7.5em;
left: -0.05em;
border-radius: 50%;
border-top: 0.4em solid transparent;
border-left: 0.4em solid #ccffff;
transform: rotate(10deg);
}
.datouwang .arms .arm:nth-child(1) {
left: 2.2em;
}
.datouwang .arms .arm:nth-child(2) {
left: 3em;
}
.datouwang .arms .arm:nth-child(3) {
left: 3.6em;
}
.datouwang .arms .arm:nth-child(4) {
left: 2.3em;
}
.datouwang .arms .arm:nth-child(5) {
left: 3.8em;
}
.datouwang .arms .arm:nth-child(6) {
left: 4.5em;
}
.datouwang .arms .arm:nth-child(7) {
left: 3em;
}
.datouwang .arms .arm:nth-child(8) {
left: 4.5em;
}
.datouwang .tentacles {
animation: squash 25s ease-in-out infinite;
will-change: transform;
}
.datouwang .tentacles .tentacle {
position: absolute;
top: 4em;
width: 10em;
height: 8em;
border: 1px solid rgba(0, 255, 255, 0.6);
border-bottom: none;
border-top: none;
border-bottom-left-radius: 10% 50%;
border-bottom-right-radius: 10% 50%;
border-top-left-radius: 20% 50%;
border-top-right-radius: 20% 50%;
}
.datouwang .tentacles .tentacle:nth-child(2) {
transform: scaleX(0.8);
}
.datouwang .tentacles .tentacle:nth-child(3) {
transform: scaleX(0.6);
}
.datouwang .tentacles .tentacle:nth-child(4) {
transform: scaleX(0.4);
}
.datouwang .tentacles .tentacle:nth-child(5) {
transform: scaleX(0.2);
}
.datouwang .guts {
width: 4em;
height: 4em;
background: white;
position: absolute;
left: 3em;
top: 0.9em;
border-radius: 50%;
box-shadow: -1.5em 0.7em 0 -0.8em white, -1.7em -0.5em 0 -1.4em white, 1.8em -0.1em 0 -1.3em white, 1em 1em 0 -0.6em white, -0.4em 1.8em 0 -1.3em white, 1.4em -1em 0 -1.5em white, -1.3em 1.8em 0 -1.5em white;
filter: drop-shadow(0 0 0.5em rgba(255, 255, 255, 0.5));
}
.datouwang .body {
background: cyan;
width: 10em;
height: 5em;
border-top-left-radius: 50% 100%;
border-top-right-radius: 50% 100%;
position: relative;
opacity: 0.65;
box-shadow: inset 0 0.2em 0 cyan, inset 0 0.4em 0 hsla(0, 0%, 100%, 0.6);
transform-origin: 50% 50%;
animation: squash 25s ease-in-out infinite;
will-change: transform;
}
.datouwang .body .base {
position: absolute;
width: 3em;
height: 1.5em;
background: cyan;
bottom: -1.3em;
border-bottom-left-radius: 50% 100%;
border-bottom-right-radius: 50% 100%;
box-shadow: 3.5em 0 0 cyan, 7em 0 0 cyan;
}
.datouwang .body .base:after {
content: '';
position: absolute;
width: 3em;
height: 1em;
left: 1.75em;
top: -0.25em;
background: radial-gradient(circle at 50% 120%, rgba(0, 255, 255, 0) 0, rgba(0, 255, 255, 0) 25%, cyan 10%, cyan 100%);
}
.datouwang .body .base:before {
content: '';
position: absolute;
width: 3em;
height: 1em;
left: 5.25em;
top: -0.25em;
background: radial-gradient(circle at 50% 120%, rgba(0, 255, 255, 0) 0, rgba(0, 255, 255, 0) 25%, cyan 10%, cyan 100%);
}
</style>
<script>
if (localStorage.getItem('bg-off')) document.querySelector('.bg').hidden = true
function randomNumber(min, max) {
return Math.random() * (max - min) + min;
}
const datouwang = document.querySelector('.datouwang')
for (let i = 0; i < 20; i++) {
const newDatouwang = datouwang.cloneNode(true)
newDatouwang.style.left = i * 5 + '%'
newDatouwang.style.top = randomNumber(0, 95) + '%'
newDatouwang.style.fontSize = randomNumber(0.5, 2) + 'rem'
newDatouwang.style.animationDuration = randomNumber(10, 30) + 's'
newDatouwang.style.animationDelay = randomNumber(0, 300) + 'ms'
newDatouwang.style.opacity = randomNumber(0.1, 0.5)
document.querySelector('.bg').appendChild(newDatouwang)
}
datouwang.hidden = true
</script>
<!-- cursor -->
<!--
<style>
*, a {
cursor: none;
}
.custom-cursor {
position: fixed;
z-index: 1001;
top: 2rem;
left: 2rem;
width: 15px;
height: 15px;
pointer-events: none;
}
.custom-cursor.click {
animation: cursor-click 800ms normal ease-in-out;
}
@keyframes cursor-click {
0%,
100% {
transform: scale(0.75) translate(0.75rem, 2.25rem);
}
}
</style>
<script>
const datouwangCursor = document.querySelector('.datouwang').cloneNode(true)
datouwangCursor.classList.add('custom-cursor')
datouwangCursor.classList.add('no-swim')
datouwangCursor.style.fontSize = '0.5rem'
datouwangCursor.style.filter = 'grayscale(90%) drop-shadow(2px 2px rgba(69, 16, 180, 0.5))'
datouwangCursor.style.transition = 'top 0.1s, left 0.1s, transform 0.5s ease-out'
document.body.appendChild(datouwangCursor)
datouwangCursor.hidden = false
const cursor = document.querySelector('.custom-cursor')
self.addEventListener('mousedown', event => {
if (!cursor.classList.contains('click')) cursor.classList.add('click')
})
self.addEventListener('mouseup', event => {
if (cursor.classList.contains('click')) cursor.classList.remove('click')
})
let _prevX = 0, _prevY = 0, _prevDirectionLeft
self.addEventListener('mousemove', event => {
const x = event.pageX - cursor.offsetWidth / 2
const y = event.pageY - cursor.offsetHeight / 2
/*if (_prevX !== x && _prevDirectionLeft !== _prevX < x) {
_prevDirectionLeft = _prevX < x
cursor.style.transform = _prevDirectionLeft ? 'rotate(7.5deg)' : 'rotate(-7.5deg)'
}*/
const left = `calc(${(_prevX = x)}px - 1.75rem)`
const top = `calc(${(_prevY = y)}px - 2.25rem)`
if (cursor.style.left !== left) cursor.style.left = left
if (cursor.style.top !== top) cursor.style.top = top
})
</script>
-->
</body>
</html>