Interaktive Bühne
Code-Gegenüberstellung
Spezifikations-Bug
Originaler Bug-Code (unicorn_solution.html)
button.addEventListener("click", () => {
- if (intervalTime > 100) {
- intervalTime -= 100; // Blinken wird SCHNELLER!
- button.textContent = "Slow Down"; // Text sagt: "Slow Down"!
- }
});
Fixed Code (Frequenz f = 1/T)
function setFrequency(hertz) {
+ const periodSeconds = 1 / hertz;
+ unicorn.style.setProperty("--blink-time", `${periodSeconds}s`);
}
// WCAG Anfallsschutz:
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
+ unicorn.classList.remove("blinking");
}