9/27 Questions:
function setup() {
createCanvas(480, 120);
noStroke();
}
function draw() {
background(0);
for (var y = 0; y < height+45; y += 40) {
for (var x = 0; x < width+45; x += 40)
fill(255, 140);
ellipse(0, y, 40, 40);
ellipse(x, 0, 40, 40);
}
//why don't these two codes result the same?
function setup()
{ createCanvas(480, 120);
noStroke(); }
function draw() {
background(0);
for (var y = 0; y < height+45; y += 40) {
fill(255, 140); ellipse(0, y, 40, 40); }
for (var x = 0; x < width+45; x += 40) {
fill(255, 140);
ellipse(x, 0, 40, 40); } }
function setup() {
createCanvas(480, 120);
}
function draw() {
background(0);
for (var y = 32; y <= height; y += 8) {
for (var x = 12; x <= width; x += 15)
ellipse(x+y, y, 16 - y/10.0, 16 - y/10.0);
}
}
//don't get the last line
//how can the circles shrink smaller as it gets to the bottom of the canvas
//what is the last two value of the map function
r=map(mouseX,0,600,0,255);
g=map(mouseX,0,600,0,200);
b=map(mouseY,0,600,255,0);
10/4 Questions:
background(random(100), 50, 100);
//what does the random(100) mean here

intersects(other) {
let d = dist(this.x, this.y, other.x, other.y);
return d < this.r + other.r;
//what does return mean?
contains(px, py) {
let d = dist(px, py, this.x, this.y);
if (d < this.r) {
return true;
} else {
return false;
}
}
//what does contains mean
//https://editor.p5js.org/codingtrain/sketches/OG-_2K16
let overlapping = false;
for (let other of bubbles) {
if (b !== other && b.intersects(other)) {
overlapping = true;
}
//make sure if b is intersecting every other bubble as long as b isn't checking itself
//https://editor.p5js.org/codingtrain/sketches/7SjPmXN2