void drawText() { int currX = TRACKING; int currY = lineHeight; for (int i=0; i < textFile.length; i++) { char c = char(textFile[i]); if (Character.isWhitespace(c)) { c = ' '; } float distance = dist(currX, currY, mouseX, mouseY); float col = map(distance, 0, flashlightSize, 0, 1); fill(col); text(c, currX, currY); currX += int(textWidth(c)+TRACKING); if (currX > (width-TRACKING)) { currX = TRACKING; currY += lineHeight+TRACKING; } if (currY > height) { break; } } }