The standard refresh rate for monitors is 60Hz – 60 times per second. This is a hardware limitation – even with perfect software timing, there’s no way to display frames more frequently than that – and humans paying attention to a screen can easily see something that appears for 1/60th of a second.
Your only option is to have the image appear and disappear with every frame (which can be done more precisely than setInterval
with requestAnimationFrame
– but it’ll still be visible to those watching closely).
// Ensure browser is not busy
setTimeout(() => {
window.requestAnimationFrame(() => {
document.body.classList.toggle('blue');
window.requestAnimationFrame(() => {
document.body.classList.toggle('blue');
});
});
}, 1000);
.blue {
background-color: blue;
}
It’s not possible for the monitor to display something for a low enough duration that it’s not perceivable.
CLICK HERE to find out more related problems solutions.