Newbie-Question about variables
in
Programming Questions
•
8 months ago
- float x;
float y;
int s = 10;
void setup() {
size(400, 400);
background(255, 245, 245);
smooth();
noStroke();
x = width/2;
y = height/2;
}
void draw() {
fill(200, 0, 0, 10);
x = x + random(-5, 5);
y = y + random(-5, 5);
x = constrain(x, 0, width);
y = constrain(y, 0, height);
ellipse(x, y, s, s);
}
Hi guys,
i need your help. I'm a newbie and im learning processing for a week. I solved
many understanding problems with the time by my own but here is a tutorial-code I don't get.
Why does this code start with:
- float x; float y; int s = 10;
??
I have no clue why I can't put this part with …
- x = width/2;
- y = height/2;
… in the void draw() block?
Thanks for your help!
1