/** * Letters. * * Draws letters to the screen. This requires loading a font, * setting the font, and then drawing the letters. */ PFont fontA; int offset=0; int i=0; int NUMCHARS=4; int letter_width=250; //String msg=" SCROLLING TEXT DISPLAY. "; String msg=" AMBIENT DISPLAY. "; void setup() { size(800, 600); background(255); smooth(); // Load the font. Fonts must be placed within the data // directory of your sketch. A font must first be created // using the 'Create Font...' option in the Tools menu. // Uncomment the following two lines to see the available fonts //String[] fontList = PFont.list(); //println(fontList); textAlign(LEFT); fontA = createFont("Helvetica-Bold", 255); fill(0); textFont(fontA, 600); //textMode(SCREEN); i=0; offset=0; } void draw() { background(255); fill(0); text(msg.substring(i, i+NUMCHARS), offset, 500); offset-=1; if(offset<-1*int(textWidth(msg.charAt(i)))) { offset=0; i+=1; }; if(i>msg.length()-NUMCHARS) { i=0; } }