JavaScript Canvas – window resize redraw

I have a canvas element that uses SetInterval to animate the entrance of a background.

var c=document.getElementById("theCircle") function drawCircle(end=2*Math.PI){ height = window.innerHeight
width = window.innerWidth var ctx=c.getContext("2d"); ctx.beginPath();
ctx.stroke(); } function counter(start,finish,speed){ var i = start var animation = setInterval(function(){ i += speed if(i>=finish){clearInterval(animation)} drawCircle(i); }, 20)
} counter(0.0,2*Math.PI,0.05)

On window resize the canvas element is resized to fit the window so that it always fills the page.

window.addEventListener('resize',posFix,false); function posFix(){ c.height = window.innerHeight
c.width = window.innerWidth drawCircle(); }

When the canvas element is resized the drawing inside is deleted. As you can see, I am calling a redraw on resize but it doesn’t seem to fire properly.

What am I missing?