-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (53 loc) · 1.56 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=300, initial-scale=1.0" />
<title>Relax</title>
<link href="style.css" rel="stylesheet" />
</head>
<script>
const app = {};
app.isNightTime = () => {
const now = new Date();
const hour = now.getHours();
return hour > 20 || hour < 6;
};
</script>
<body
x-data="{ dur: $persist(5), step: 0.35 }"
:class="app.isNightTime() ? 'dark-theme' : ''"
>
<div class="svg-container">
<center>
<h3>Breathe In And Out</h3>
<svg xmlns="https://www.w3.org/2000/svg" viewbox="0 0 50 50">
<circle cx="50%" cy="50%" r="12%" onclick="window.location.reload();">
<animate
attributeName="r"
values="12%;19%;19%;12%;12%"
:dur="dur + 's'"
repeatCount="indefinite"
/>
<animate
attributeName="fill"
values="#485359;#A2D4F2;#A2D4F2;#485359;#485359"
:dur="dur + 's'"
repeatCount="indefinite"
/>
</circle>
</svg>
<button @click="dur += step">tortoise</button>
<button @click="(dur - step) > 0 ? dur -= step : dur = (step/2)">
rabbit
</button>
</center>
</div>
<script
src="//unpkg.com/@alpinejs/persist@3.12.0/dist/cdn.min.js"
defer
></script>
<script src="//unpkg.com/alpinejs" defer></script>
</body>
</html>