xxxxxxxxxx
String text1 = "Type Here: ";
PFont courier;
int counter;
void setup() {
size(400, 400);
frameRate(6);
smooth();
courier = createFont("courierPrime.ttf", 1);
textFont(courier, 20);
}
void draw() {
background(150);
fill(255);
typewriter();
}
void typewriter(){
if (counter < text1.length())
counter++;
text(text1.substring(0, counter), 0, 40, width, height);
}
void keyPressed() {
text1 += String(key);
}