// colors; color a = 0xff000000; color b = 0xffffffff; //initial colors color m; color n; //phase color color ci; // initial color color fc; // final color color clcolor; // click point color // ints; int cmode = 1; // color mode int x; int y; //coordinates int cx; int cy; // center coordinates int tempx; // temporary x coord; int prevx; // previous x coord; int r = 1; //initial radius int dmode; // draw mode int w; // width int h; // height int time; // timer int freq; // frequency void setup() { size (600, 300); w = width; h = height; background(a); freq = 10; cmode = 1; dmode = 1; cx=300; cy=150; } void loop() { if(keyPressed){ if(key == '1') { freq = 0; } if(key == '2') { freq = 2; } if(key == '3') { freq = 5; } if(key == '4') { freq = 10; } if(key == '5') { freq = 20; } if(key == '6') { freq = 40; } if(key == ' ') { background(a); } if(key == 'z') { cmode = 1; } if(key == 'x') { cmode = 0; } if(key == 'c') { dmode=1; } if(key == RIGHT) { dmode=2; } if(key == LEFT) { dmode=3; } if(key == UP) { dmode=4; } if(key == DOWN) { dmode=5; } if(key == 's') { saveFrame("riley-####.tif"); } } if(mousePressed==true){ timer(); if(dmode==1) { circle(); //draw circle } else if (dmode==2) { vline_r(); //draw line } else if (dmode==3) { vline_l(); } else if (dmode==4) { hline_u(); } else if (dmode==5) { hline_d(); } r++; // increase radius } } void mousePressed() { time = 0; // resetting timer r = 1; //setting radius cx = mouseX; cy = mouseY; // getting coordinates clcolor = get(cx,cy); if (clcolor==a) {fc=m; } else if(clcolor==b) {fc=n; } set(cx,cy, fc); } void mouseDragged() { freq = (int) abs(cx-mouseX)/2; // setting frequency to mouse drag } void timer() { if(time<=freq) { m = b; n = a; } else if(time>freq&&time