Hello,
I am new to processing and I really need some help. I would highly appreciate it if you could give me a clue on which direction I need to take or which is the best way to implement my idea.
I want to start with a 3D object (let's say a cube) and have the program change the values/parameters (width of base, width of top, height, orientation, new points/curves along the surfaces) based on the word content of a loaded text file. I want the program to detect specified in the code words.
If (the word “more” is used within the text) {
Increase the width of the cube}
if (the word “time” is used within the text) {
Rotate the object 20 degrees to the left}
If (the word “smooth” is used within the text) {
Flatten the edges of the shape by 1}
…and more
Basically, I want to have the cube transform into any another object (cylinder, cone, conical frustum etc) based on the presence of specified words in the text file.
Increase the width of the cube}
if (the word “time” is used within the text) {
Rotate the object 20 degrees to the left}
If (the word “smooth” is used within the text) {
Flatten the edges of the shape by 1}
…and more
Basically, I want to have the cube transform into any another object (cylinder, cone, conical frustum etc) based on the presence of specified words in the text file.
I tried the following way: put a random text in a txt file and loaded the file in Processing
lines = loadStrings("story.txt");
…
for (int i = 0; i < lines.length; i++) {
if (lines[i].equals("love")==true) {
println("love");
fill(255, 0, 0);
rect(width/4, height/4, width/2, height/2);
}
However, I had to separate each word into a line in order for the program to read every word. I need the program to consider all the words without me having to separate them into lines.
…
for (int i = 0; i < lines.length; i++) {
if (lines[i].equals("love")==true) {
println("love");
fill(255, 0, 0);
rect(width/4, height/4, width/2, height/2);
}
However, I had to separate each word into a line in order for the program to read every word. I need the program to consider all the words without me having to separate them into lines.
Thank you so much for your help!!
1