char currentkey = '1'; color bgc = color(0); void setup() { size(800, 800); background(0); smooth(); } void draw() { // triggering the clear_print function if(keyPressed) { clear_print(); } // triggering the newkeychoice if(mousePressed) { drawChoice(); } record(); } void drawChoice() { // the key mapping if statemens that you can change to do anything you want. // just make sure each key option has the a stroke or fill and then what type of // graphic function // key global variable contains whatever key was last pressed char currentkey = key; switch(currentkey) { case '1': println("1"); // purple line drawline(color(107,67,200), mouseX, mouseY, pmouseX, pmouseY); break; case '2': println("2"); // pink line drawline(color(253,18,253), mouseX, mouseY, pmouseX, pmouseY); break; case '3': println("3"); // orange circle bigline(color(248,137,22,20), mouseX, mouseY, pmouseX, pmouseY); break; case '4': println("4"); // pink square glitch(color(241,27,125), mouseX, mouseY, pmouseX, pmouseY); break; case '5': println("5"); // erase drawline(color(0), mouseX, mouseY, pmouseX, pmouseY); break; case '6': println("6"); // white stars stars(color(255),mouseX, mouseY); break; case '7': println("7"); // blue neon blueneon(color(0, 200, 255,70), mouseX, mouseY, pmouseX, pmouseY); break; default: // Default executes if the case labels println("None"); // don't match the switch parameter break; } } void drawline(color k, int lx,int ly, int px,int py) { strokeWeight(5); stroke(k); line(lx, ly, px, py); } void blueneon(color k, int lx,int ly, int px,int py) { strokeWeight(15); stroke(k); line(lx, ly, px, py); } void bigline(color k, int lx,int ly, int px,int py) { strokeWeight(200); stroke(k); line(lx, ly, px, py); } void stars (color k , int lx, int ly) { //2 numbers = random value btwn 10 and 100 noStroke(); float r =random (1, 5); float xr = random(1, 50); float yr = random(1, 50); fill(k); ellipse(lx + xr, ly + yr, r, r); } void glitch(color k, int lx,int ly, int px,int py) { strokeWeight(5); stroke(0); float r =random (30, 50); float xr = random(20, 5); float yr = random(-10,10); fill(k); rect(lx + xr, ly + yr, r, r); } void clear_print() { // these 2 options let you choose between clearing the background // and saveing the current image as a file. if (key == 'x' || key == 'X') { background(255); } else if (key == 'p' || key == 'P') { saveFrame("x_xxx_####.png"); //this will save the name as the intials and a random counting number. // it will always be larger in value then the last one. delay(500); } } void record(){ if(frameCount < 500){ saveFrame("images/testr_####.jpg"); }else{ exit(); } }