Hjernebølger: Delta, Theta, Alpha og Gamma
<!DOCTYPE html>
<html lang=”da”>
<head>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<title>Blinkende Lys med Hjernebølgefrekvenser</title>
<style>
body {
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: black;
color: white;
font-family: Arial, sans-serif;
}
.light {
width: 100%;
height: 100%;
background-color: black;
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
.controls {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
gap: 10px;
}
.controls button {
padding: 15px;
font-size: 18px;
margin: 5px;
border: none;
border-radius: 5px;
cursor: pointer;
background-color: #444;
color: white;
width: 200px;
}
.controls button:hover {
opacity: 0.8;
}
</style>
</head>
<body>
<div class=”light” id=”light”></div>
<div class=”controls”>
<button onclick=”startBlinking(1)”>Delta (1 Hz)</button>
<button onclick=”startBlinking(2)”>Theta (4 Hz)</button>
<button onclick=”startBlinking(10)”>Alpha (10 Hz)</button>
<button onclick=”startBlinking(20)”>Beta (20 Hz)</button>
<button onclick=”startBlinking(40)”>Gamma (40 Hz)</button>
<button onclick=”stopBlinking()”>Stop</button>
</div>
<script>
const light = document.getElementById(‘light’);
let blinkId;
// Funktion til at starte blinkning med den valgte frekvens (Hz)
function startBlinking(frequency) {
const blinkInterval = 1000 / (frequency * 2); // Beregn blinkinterval (ms)
clearInterval(blinkId); // Stop tidligere blink
blinkId = setInterval(() => {
// Skift mellem sort og hvid
light.style.backgroundColor = light.style.backgroundColor === ‘white’ ? ‘black’ : ‘white’;
}, blinkInterval);
}
// Funktion til at stoppe blinkning
function stopBlinking() {
clearInterval(blinkId);
light.style.backgroundColor = ‘black’; // Sæt lyset tilbage til sort
}
</script>
</body>
</html>