// Dartmouth CS 2, Winter 2009, Chris Bailey-Kellogg // Notes 8 | Sketch 2 int sz = 25; // how big to draw void setup() { noStroke(); smooth(); } void draw() { // Nothing to do here (but need the blank function anyway) } void mousePressed() { fill(random(255),random(255),random(255)); drawC(mouseX, mouseY, sz); } void keyPressed() { if (key=='Z') { // Bigger if (sz<50) sz+=5; } else if (key=='z') { if (sz > 5) sz-=5; } } // Draw a letter "C" of size s, with the upper left at (x,y). void drawC(float x, float y, int s) { beginShape(); vertex(x, y); vertex(x+s, y); vertex(x+s, y+0.2*s); vertex(x+0.2*s, y+0.2*s); vertex(x+0.2*s, y+0.8*s); vertex(x+s, y+0.8*s); vertex(x+s, y+s); vertex(x, y+s); endShape(CLOSE); }