var Circle = {
numberCircles: 5,
colors: ["#780000", "#c1121f", "#fdf0d5", "#003049", "#669bbc"],
//create circle
draw: function (x, y) {
x = propCircle.x;
y = propCircle.y;
context.beginPath();
radius = Math.random() * 10 + 1;
fill = Circle.colors[Math.round(Math.random() * colors.length - 1)];
context.arc(x, y, radius, 0, 2 * Math.PI, false);
if (fill) {
context.fillStyle = fill;
context.fill();
}
},
sprayCircle: function () {
for (let i = 0; i < Circle.numberCircles; i++) {
let los = Math.round(Math.random() * 3);
switch (los) {
case 0:
this.draw(propCircle.x + Math.random() * 30 + 10, propCircle.y + Math.random() * 50);
break;
case 1:
this.draw(propCircle.x + Math.random() * 30 + 10, propCircle.y - Math.random() * 50);
break;
case 2:
this.draw(propCircle.x - Math.random() * 5, propCircle.y - Math.random() * 5);
break;
}
}
},
};
dlaczego consola zwraca błąd is not definited
EDIT
var Circle = {
numberCircles: 5,
colors: ["#780000", "#c1121f", "#fdf0d5", "#003049", "#669bbc"],
//create circle
draw(x, y) {
x = propCircle.x;
y = propCircle.y;
context.beginPath();
radius = Math.random() * 10 + 1;
fill = Circle.colors[Math.round(Math.random() * colors.length - 1)];
context.arc(x, y, radius, 0, 2 * Math.PI, false);
if (fill) {
context.fillStyle = fill;
context.fill();
}
},
//spray
sprayCircle() {
for (let i = 0; i < Circle.numberCircles; i++) {
let los = Math.round(Math.random() * 3);
switch (los) {
case 0:
this.draw(propCircle.x + Math.random() * 30 + 10, propCircle.y + Math.random() * 50);
break;
case 1:
this.draw(propCircle.x + Math.random() * 30 + 10, propCircle.y - Math.random() * 50);
break;
case 2:
this.draw(propCircle.x - Math.random() * 5, propCircle.y - Math.random() * 5);
break;
}
}
},
};