console
window.onload = function() {
setInterval(() => {
openEye()
}, 400)
setTimeout(closeEye, 2000);
};
function openEye() {
const imgs = document.querySelectorAll('.animate img');
const imgOpen = imgs[0];
const imgClose = imgs[1];
imgOpen.style.display = 'block';
imgClose.style.display= 'none';
}
function closeEye() {
const imgs = document.querySelectorAll('.animate img');
const imgOpen = imgs[0];
const imgClose = imgs[1];
setInterval(() => {
imgOpen.style.display = 'none';
imgClose.style.display= 'block';
}, 5000)
}
<div class="animate">
<img src="https://i0.hdslb.com/bfs/vc/082e39ef757826401ef82da818310d42e05bc2de.png"></img>
<img src="https://i0.hdslb.com/bfs/vc/173eafe211b4671e5aff059a1834f3e4579c7a5d.png"></img>
</div>
.animate {
width: 1000px;
background: pink;
}
.animate img {
width: 100%;
}
.animate img:last-of-type {
display: none;
}