I have an interval that runs each seven seconds. Alongside I have two gifs each lasting for seven seconds. I want to display one of the gifs in a div (here it is called face) based on some conditions, let's assume if Time is multiple of 14. The problem is that there is always a blackout (black page) between the transaction. What I want is a smooth transaction without the black frame. here is the simplified code:
const face = document.getElementById('face');
var one = "<img src='1.gif'/>";
var two = "<img src='2.gif'/>";
Time = 0;
function myTimer() {
Time = Time + 1;
if (Time%14 ===0){
console.log("gif one");
face.innerHTML = one;
}else{
console.log("gif two");
face.innerHTML = two;
}
}
var myVar = setInterval(myTimer, 7000);
<div class="content">
<div id="face"> </div>
</div>