/** * Future Calligraphy III * by Joseph Gray * * March 3rd 2009 * */ float distance = 0; float px = 0, py = 0; int rand = 0, prevRand = 0, randDistance = 10; int i=0; // int curveMod = 30; // float randX = 0, randY = 0, prevRandX = 0, prevRandY = 0; // effects scale int mod = 5; int newOffX = -mod; int newOffY = -mod; int newWidth = (mod*2)+width; int newHeight = (mod*2)+height; void setup() { size(300, 600); frameRate(30); cursor(CROSS); smooth(); } void draw() { if (focused) { // ++i; if (i>255) i=0; fill(i, 55, 11, 4); noStroke(); rect(0, 0, width, height); // randDistance = abs(prevRand-rand); rand = round(random(randDistance+50)); distance = abs(pmouseX-mouseX)*.5; stroke(i*.5, 255-i, 255-distance+rand, 255); strokeWeight((distance+rand)*.1); randX = mouseX+((curveMod*.5)-random(curveMod))+distance; randY = mouseY+((curveMod*.5)-random(curveMod))+distance; bezier(pmouseX, pmouseY, prevRandX, prevRandY, randX, randY, mouseX, mouseY); // prevRand = rand; prevRandX = randX; prevRandY = randY; // filter(DILATE); blend(0, 0, width, height, -1, -1, width+1, height+1, BLEND); filter(ERODE); if(mousePressed) { blend(0, 0, width, height, newOffX, newOffY, newWidth, newHeight, OVERLAY); filter(DILATE); } } }