Music Box Pattern
sketch
// sofia syjuco
// section A
// smsyjuco@andrew.cmu.edu
// Assignment-5-C
function setup() {
createCanvas(400, 200);// create a cavas
}
function draw() {
background(244, 100, 123);//make a pink background
pattern(0, 0); // row 1, grid 1 of pattern
pattern(100, 0); // row 1, grid 2 of pattern
pattern(200, 0);// row 1, grid 3, of pattern
pattern (300, 0); // row 1, grid 4 of pattern
pattern(0, 100); // row 2, grid 1 of pattern
pattern(100, 100); //row 2, grid 2 of pattern
pattern (200, 100);// row 2, grid 3 of pattern
pattern (300, 100); // row 2, grid 4 of pattern
}
function pattern(x,y){
fill("gold"); // fill shapes with gold color
stroke(255); // strokes are colored white
push();
translate(x, y);// place pattern square in designated position
for (var yPos = 10; yPos < 100; yPos +=10){ //draw all the horizontal lines
line(0, yPos, 40, yPos); // lines on left
line (40, yPos, random(41, 59), yPos-(random(2, 9)));// draw random line
line(60, yPos, 100, yPos); // lines on right
ellipse (60, yPos, 5, 5);// draw an ellipse
}
noLoop(); // don't make it repeat. Keep it static
pop();
}
I’ve been thinking about music boxes lately, just as a kind of portable nostalgia, and thought it might be interesting to make a pattern that incorporated elements of music boxes. I wanted to make it a little non-representational, but just enough that someone looking at it wouldn’t immediately guess music box – but they could come to that conclusion if they spent a little time with it. To add subtle variation, and not make it too staid, I added a subtle variation to how the little tines are bent, as if the whole pattern is in the middle of playing some huge song.