In my code, I have an interval set to run every seven seconds. Within this interval, there are two gifs that each last for seven seconds. My goal is to display one of the gifs in a div (referred to as "face") based on certain conditions - for example, if the Time is a multiple of 14. However, there seems to be an issue where there's always a black screen between the transitions. I am looking for a solution that allows for a seamless transition without the black frame interrupting.
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>