textWidth()
in
Programming Questions
•
3 years ago
Hello!
I want to use textWidth in a for() loop.
it looks something like this:
- String[] stats = loadStrings("stats_artists_genres.txt");
- for(int i = 0; i < stats.length; i++) {
- String name = s.substring(0,pos);
- String name1 = name.trim();
- pushMatrix();
- fill(255);
- textSize(14);
- textAlign(RIGHT);
- tl = textWidth(name1);
- text("" + name1, -width/3, -600);
- popMatrix();
- }
The problem here is that the textWidth only gives me 1 width.
It looks like the textWidth is not going along with the for() loop.
I want the textWidth to spit out each value for name1. (100 names in a string)
Can anybody help me out a bit here? I can't seem to figure out where the problem is...
1