We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Does anyone know why the color function isn't working here? I've tried a ton of stuff.
x = 0;
y = 200;
rad = 10;
col = color(255, 0, 100);
var bubble = {
x: 150,
y: 200,
r: 50,
display: function() {
noStroke();
fill(col);
ellipse(this.x, this.y, this.r, this.r);
ellipse(this.x*2, this.y, this.r, this.r);
ellipse(this.x*3, this.y, this.r, this.r);
ellipse(this.x*4, this.y, this.r, this.r);
}
}
function setup() {
createCanvas(800, 400);
}
function draw() {
background(200);
bubble.display();
noStroke();
fill(0);
ellipse(x, y, rad, rad);
x += 2;
}
Answers
Hi again, I put:
in setup and it worked.
It is a good habit to init all your objects and variables in setup. That is the reason it is there in the first place. However, most people opt not to do it... personal preference I suppose...
Glad you figure it out! :ar!
Kf