Question with Store text in a String
in
Programming Questions
•
5 months ago
I can't quite figure out why when I run the code below I get the error message
The function size() does not exist. When I comment out this code the sketch runs, but the words do not fade out.
The objective is
draw a black rectangle over the words currently on the stage so the
words fade out randomly.
The draw syntax is from Jer Thorp's tutorial:
http://blog.blprnt.com/blog/blprnt/updated-quick-tutorial-processing-twitter#idc-cover
Any suggestions are very much appreciated!
- String words = "The sun is shining The weather is sweet Makes me want to move my dancing feet";
- String[] list = split(words, ' ');
- void setup() {
- size(550,550);
- background(0);
- smooth();
- }
- //Draw a faint black rectangle over what is currently on the stage so it fades over time.
- void draw() {
- fill(0,1);
- rect(0,0,width,height);
- //Draw a word from the list of words
- //int i = (frameCount % words.size());
- //String words = words.get(i);
- //Put it somewhere random on the stage, with a random size and colour
- fill(255,random(50,150));
- textSize(random(10,30));
- text(words, random(width), random(height));
- }
1