function setup() {
createCanvas(600, 400);
}
function draw() {
background(255);
drawPatter(); //call function drawPatter
noLoop();
}
function drawPatter() {
// draw blue background line
for(var i = 20; i < width; i += 60){
strokeWeight(7);
stroke(60, 211, 206, 50);
line(i, 0, i, height);
}
// draw red background line
for(var p = 10; p < width; p += 90){
strokeWeight(3);
stroke(255, 66, 0, 70);
line(p, 0, p, height);
}
// draw the bubbles with ellipses with low opacity
for (var y = 50; y < height + 50; y += 100) {
for (var x = 50; x < width + 50; x += 100) {
noStroke();
var r = (y/200) * 255;
var w = (x/200) * 255;
fill(r / 32, w, 180, 50);
ellipse(x, y, 30, 30);
fill(134, w / 2, r, 50);
ellipse(x + 18, y + 15, 30, 30);
fill(r, w, 100, 50);
ellipse(x + 18, y - 10, 30, 30);
fill(r, w, 100, 50);
ellipse(x + 10, y + 23, 20, 20);
fill(r / 40, 0, 100, 50);
ellipse(x + 10, y + 10, 10, 10);
fill(r / 2, w, 100, 50);
ellipse(x + 10, y + 10, 10, 10);
fill(r, 0, 100, 50);
ellipse(x + 30, y + 30, 50, 50);
}
}
}
I enjoyed this assignment because it really allowed me to be creative. My wallpaper is a pattern of colorful bubbles, and I was inspired by the old wallpaper I had as a child. Although it does not look similar to my actual wallpaper, I had fun making new designs from my memory.