week 9: cobbled street
I based this week's project on the cobblestone pavements that I often see in the streets of England at home. They are a common sight and a very repetitive and interesting form. The idea was to produce a repeated pattern of the stones and some grass between, and hopefully having the stones moving up the screen so that it looks like the person is walking.
file download
/* Float xPos; Float yPos; FloatList[] posX; FloatList[] posY; Float rax = random(0,100); Float ray = random(0,100); */ Float ySpeed = 1.0; PImage img; Float yOffset = 0.0; //for vertical movement, increases gradually
float v100 = 100.0; //the vertical distance betewwen cobbles float vMax = v100 * 10;
void setup() { size(500, 700); img= loadImage("grass.png"); }
void draw() { background(68,59,50); /*for (int l=0; l<100; l++){ image(img,l*100 + posX[l].get(n), 100 + posY[l].get(n)); } */ //drawGrass(200,200); //drawCobble(150, 200); //drawCobble(300, 400); /*for (int i = 1; i<100; i ++){ drawCobble(60, i*100-110); } for (int i = 1; i<100; i ++){ drawCobble(60, i*100-110); } */ yOffset = yOffset + ySpeed; for (int x = 1; x<16; x ++){ drawColumn(x, yOffset); } if (yOffset > (v100 * 20 - 1000)) yOffset = -0.0; image(img,200,yOffset - 320); image(img,0,yOffset); //for int }
void drawColumn(float x, float Vert){ float yShift = Vert + (x * 40) - vMax - 1000 ; //.. for (int i = 1; i<100; i ++){ drawCobble(x*60-100, yShift + i * v100 - 90); } }
void drawCobble(float x, float y) { pushMatrix(); translate(x, y); fill(153, 143, 133); stroke(153,153,153); strokeWeight(3); rect(10,10, 40,80); popMatrix(); }
void drawGrass(float m, float n) { pushMatrix(); translate(m,n); fill(100,193,69); stroke(161,216,143); /* beginShape(); fill(100,193,69); stroke(161,216,143); line(40,30, 30, 10); line(30,10,35, 40); line(40,30, 43, 8); line(43,8, 50, 30); line(50,30, 51, 27); line(51,27, 54, 25); line(54, 25, 50, 40); line(50,40, 35,40); endShape(); */ popMatrix(); }