Skip to content

Commit

Permalink
Clear the canvas everytime in drawEntities function
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhinna Adhikari committed Mar 22, 2021
1 parent 2a3b86a commit 63a30e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ function resumeSimulation(){

function animateLoop(){
animateFrameReqId = requestAnimationFrame(animateLoop);
ctx.clearRect(0,0,canvas.width, canvas.height);
running = true;

// Draw the entities
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 63a30e2

Please sign in to comment.