var can = document.getElementById('canvas');
var cn = can.getContext('2d');
cn.fillStyle = 'black';
cn.fillRect(0, 0, can.width, can.height);
class object {
constructor(r,sa,ea) {
this.x = Math.floor(Math.random()*800);
this.y = Math.floor(Math.random()*600);
this.r = r;
this.sa = sa;
this.ea = ea;
console.log('object successfully created')
}
drawcircle(){
cn.strokeStyle = "white"
cn.arc(this.x,this.y,this.r,this.sa,this.ea,false);
cn.lineWidth = 3;
cn.stroke();
}
}
var i;
for(i = 0 ; i < 100 ; i++) {
var circle = new object(5, 0, Math.PI*2);
circle.drawcircle();
}
mercredi 4 avril 2018
why do i see the lines joining my circles in my code?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire