-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathganzfeld.html
56 lines (52 loc) · 1.74 KB
/
ganzfeld.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ganzfeld Effect</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<style>
body, html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
#color-box {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="color-box"></div>
<script>
const colors = ["red", "green", "blue", "orange", "yellow", "cyan", "indigo"];
const colorBox = document.getElementById('color-box');
let index = 0;
function changeColor() {
colorBox.style.backgroundColor = colors[index];
index = (index + 1) % colors.length;
}
function toggleFullScreen() {
if (!document.fullscreenElement && !document.webkitFullscreenElement) {
if (colorBox.requestFullscreen) {
colorBox.requestFullscreen();
} else if (colorBox.webkitRequestFullscreen) {
colorBox.webkitRequestFullscreen();
}
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
}
colorBox.addEventListener('dblclick', toggleFullScreen);
setInterval(changeColor, 10); // 0.01 seconds = 10 milliseconds
</script>
</body>
</html>