Helle everyone!
My name is Nick and I'm new to processing. I've actually never done anythng from this sort and I ran into a little bit of a problem. I want to make an infograpic that displays one "income" and (for now) two "expanses". And so far its working. The only problem is that I want to change the float a/d from a random to a number pulled from a text file. I've been trying to get something going by using Strings but I really have no idea what I'm doing here. So I hope you guys might be able to help me!
This is my code so far:
float a;
float b;
float c;
float d;
float e;
float f;
float g;
float h;
float i;
float j;
void setup() {
size(450, 450);
stroke(255);
background(192, 64, 0);
String[] data = loadStrings("data.txt");
}
void draw() {
frameRate(1);
a = random (100);
b = random (100);
c = random (100);
d = random (100);
e = a+b;
f = a/e*400;
g = b/e*400;
h = c+d;
i = c/h*400;
j = d/h*400;
background(192, 64, 0);
fill(150);
rect(25, 25, f, 400);
fill(200);
rect(f+25, 25, g, i);
fill(255);
rect(f+25, i+25, g, j);
}
Thanks is advance, and I hope to hear something from you all soon!
1