let btn = document.querySelector('.btn')
let circle = document.querySelector('.inner-circle')
let interval;
let fill = 433;
btn.addEventListener('mouseenter', () => {
clearInterval(interval);
interval = setInterval(() => {
if(fill < 5) {
fill = 0;
circle.style.strokeDashoffset = fill;
clearInterval(interval);
return;
}
fill -= 5;
circle.style.strokeDashoffset = fill;
}, 10);
});
btn.addEventListener('mouseleave', () => {
clearInterval(interval);
interval = setInterval(() => {
if(fill > 428) {
fill = 433;
circle.style.strokeDashoffset = fill;
clearInterval(interval);
return;
}
fill += 5;
circle.style.strokeDashoffset = fill;
}, 10);
});