Good morning!
This is my lovely selfie. It is complete with my utter lack of drawing ability and disgustingly large smile.
For those of you who are confused about the title of this post, check it out:
https://www.youtube.com/watch?v=s2XymdmLQhE
And here’s the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
float lineWidth = 3; void setup() { size(800, 600); background(255); noStroke(); fill(243, 192, 91); rect(700, 0, 100, 120); fill(42, 129, 5); rect(700, 120, 100, 120); fill(119, 71, 8); rect(700, 240, 100, 120); fill(255); rect(700, 360, 100, 120); fill(0); rect(700, 480, 100, 120); } void draw() { strokeWeight(lineWidth); // set the stroke weight if (mousePressed && mouseButton == LEFT) { line(mouseX, mouseY, pmouseX, pmouseY); // draw a line } if (mousePressed && mouseX >=700 && mouseY <= 100) { stroke(243, 192, 91); } if (mousePressed && mouseX >=700 && mouseY <= 200 && mouseY >=100) { stroke(42, 129, 5); } if (mousePressed && mouseX >=700 && mouseY <= 300 && mouseY >=200) { stroke(119, 71, 8); } if (mousePressed && mouseX >=700 && mouseY <= 400 && mouseY >=300) { stroke(255); } if (mousePressed && mouseX >=700 && mouseY <= 500 && mouseY >=400) { stroke(0); } } void keyPressed() { if (key == '+') { lineWidth++; } if (key == '-') { lineWidth--; if (lineWidth <=0) { lineWidth = 1; } } if (key == ' ') { background(255); noStroke(); fill(243, 192, 91); rect(700, 0, 100, 120); fill(42, 129, 5); rect(700, 120, 100, 120); fill(119, 71, 8); rect(700, 240, 100, 120); fill(255); rect(700, 360, 100, 120); fill(0); rect(700, 480, 100, 120); } } |