Skip to content

Instantly share code, notes, and snippets.

@midorikocak
Created December 19, 2019 12:58
Show Gist options
  • Save midorikocak/fd13b011f7715c88e27ef4c7b74ac0be to your computer and use it in GitHub Desktop.
Save midorikocak/fd13b011f7715c88e27ef4c7b74ac0be to your computer and use it in GitHub Desktop.
Processing Example
String words[];
void setup() {
words = loadStrings("speech.txt");
size(640, 360);
background(255);
fill(0);
background(255);
float indent = 0;
float offset = 0;
for (int i = 0; i < words.length; i++) {
indent += i == 0 ? 0 : textWidth(words[i-1]);
indent = indent > 640 ? 0 : indent;
if(indent>640){
indent = 0;
offset += 16;
}
else{
offset += 16;
}
println(indent);
textSize(16);
text(words[i], indent, offset );
}
}
void draw() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment