// 6.914 HW0 #1 float pos = 0; void setup(){ size(200, 200); } void draw(){ background(100); ellipse(width-pos, pos, 10, 10); pos++; } // 6.914 HW0 #2 void setup(){ size(200, 600); } void draw(){ background(0); fill(255, 0, 0); // red rect(50, 0, 100, 100); fill(255, 150, 0); //orange rect(50, 100, 100, 100); fill(255, 255, 0); // yellow rect(50, 200, 100, 100); fill(0, 200, 0); // green rect(50, 300, 100, 100); fill(0, 0, 255); // blue rect(50, 400, 100, 100); fill(150, 0, 150); // purple rect(50, 500, 100, 100); } // 6.914 HW0 #3 beginShape(TRIANGLE_FAN); vertex(200, 200); vertex(200, 100); vertex(250, 150); vertex(350, 200); vertex(250, 250); vertex(200, 300); vertex(150, 250); vertex(50, 200); vertex(150, 150); vertex(200, 100); vertex(200, 200); // this vertex is optional endShape(CLOSE); // 6.914 HW0 #4 int pos = 100; void setup(){ size(500, 500); } void draw(){ background(0); if (pos < 400){ // this makes the bottom right corner always in the same place rect(pos, pos, 400-pos, 400-pos); pos++; } else { // this restarts it pos = 100; } } // 6.914 HW0 #5 int pos = 0; void setup(){ size(300, 150); } void draw(){ background(255); // red wide ellipse fill(255, 0, 0, 100); ellipse(pos, 50, 80, 50); // blue tall ellipse fill(0, 0, 255, 100); ellipse(width-pos, 50, 50, 80); pos++; }