0

I'm swapping 2 circles color but when I swap them based on a timer the strokes do not swap even though I don't even have a stroke applied to them:

Image reference: After and Before

And code for reference: JSFiddle link

function sw(obj1, obj2){
  obj1.color = [obj2.color, obj2.color = obj1.color][0];
  console.log("Changed");
  render();
}

function render(){
  _dots[0].draw();
  _dots[1].draw();
}

render();   

setTimeout(function(){
 sw( _dots[0] ,  _dots[1] )
},1000 )
Kijewski
  • 25,517
  • 12
  • 101
  • 143
Xtal
  • 295
  • 5
  • 20

1 Answers1

2

The antialiased edges are drawing over the last frame rendered, making the edges appear purple. Clear the canvas before drawing the next frame.

Community
  • 1
  • 1
Dagg Nabbit
  • 75,346
  • 19
  • 113
  • 141