From 63a30e258c096d7c96e2a22992a91eb2347f8364 Mon Sep 17 00:00:00 2001 From: Abhinna Adhikari Date: Mon, 22 Mar 2021 13:23:09 -0400 Subject: [PATCH] Clear the canvas everytime in drawEntities function --- static/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/index.js b/static/js/index.js index 04b6f78..b046663 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -70,7 +70,6 @@ function resumeSimulation(){ function animateLoop(){ animateFrameReqId = requestAnimationFrame(animateLoop); - ctx.clearRect(0,0,canvas.width, canvas.height); running = true; // Draw the entities @@ -167,6 +166,7 @@ function animateLoop(){ function drawEntities(entities){ // Draws a list of entities to the canvas + ctx.clearRect(0,0,canvas.width, canvas.height); for(let entity of entities){ entity.draw(); }