There is a small easter egg in the TED talk that I gave last weekend, and it is a visual quine for Processing.
By this definition, my program is strictly speaking not a quine, because the output is not the source code of the program, but a visualization of the source code. This program simply visualizes itself. In any case, it's fun.
Here is the code if you are interested! PS. If you do try it, you have to save it with the name “SelfDrawingSketch.pde”, otherwise it will not work.
String[] lines;
PFont font;
int counter;
float currentWidth, currentHeight;
void setup() {
size(600, 800);
lines = loadStrings("SelfDrawingSketch.pde");
font = createFont("SourceCodePro-Regular", 12);
textFont(font);
stroke(0, 255, 0, 60);
fill(255);
}
void draw() {
background(30);
counter = 0;
currentWidth = 40;
currentHeight = g.textLeading;
for (int i=0; i<lines.length; i++) {
textAlign(RIGHT);
text(i+1, currentWidth-20, currentHeight);
textAlign(LEFT);
line(40, currentHeight, 40 + textWidth(lines[i]), currentHeight);
for (int j=0; j<lines[i].length(); j++) {
char c = lines[i].charAt(j);
if (counter < frameCount) {
text(c, currentWidth, currentHeight);
counter++;
}
currentWidth += textWidth(c);
}
currentWidth = 40;
currentHeight += g.textLeading;
}
}