// ReakType // 2006 // TypePattern String // by Michael Pichler import processing.opengl.*; int leftmargin = 10; int rightmargin = 20; String buff = ""; void setup(){ size(800,600,OPENGL); background(255); PFont font; font = loadFont ("HelveticaNeue-48.vlw"); textFont(font, 10); textAlign(LEFT); fill(255); } void keyPressed() { char k; k = (char)key; switch(k){ case 8: if(buff.length()>0){ buff = buff.substring(1); } break; case 13: // Avoid special keys case 10: case 65535: case 127: case 27: break; default: if(textWidth(buff+k)+leftmargin < width-rightmargin){ buff=buff+k; } break; } } void draw(){ if (mousePressed == true) { fill(0); } else{ fill(255); } noStroke(); int randomDegrees = int(random(360)); float randomRadiant = radians(randomDegrees); int randomDistance = int(random(60)); float randomPosX = mouseX + (cos(randomRadiant)*randomDistance); float randomPosY = mouseY + (sin(randomRadiant)*randomDistance); text(buff, randomPosX,randomPosY); // Reset Stage and String if (mouseButton == RIGHT) { fill(255); rect(0,0,800,600); buff = ""; } }