beginnig
in
Programming Questions
•
2 years ago
i have problem with this example of code, im on beginig of my way with processing...
the problem is about the condition i make
float lineX = 0;
float lineY = 0;
float lineH = 100;
float lineW = 50;
float lineStroke = 255;
float backgroundColor = 255;
float change = 0.5;
int w = int(random(1,4));
void setup (){
size (200,200);
smooth();
}
void draw(){
background(backgroundColor) ;
stroke(lineStroke) ;
line(lineX,lineY,w,lineH);
line(lineX,lineY,lineW,lineH*2);
line(lineX,lineY+w,lineW,lineH*4);
line(lineX,lineY,lineW,lineH*6);
lineX= lineX +1;
lineY= lineY +1;
lineW= lineW - change;
lineH= lineH + change;
lineStroke = w + 1 ;
if ( lineX >= 200) {
lineX < 200;
}
}
so i wish that line is swimming till it is x=200 and then coming back to 0 position,
possible is im wrong and dont undrestend the way conditionals working.....but wish to understand
thanks for patience
lou
the problem is about the condition i make
float lineX = 0;
float lineY = 0;
float lineH = 100;
float lineW = 50;
float lineStroke = 255;
float backgroundColor = 255;
float change = 0.5;
int w = int(random(1,4));
void setup (){
size (200,200);
smooth();
}
void draw(){
background(backgroundColor) ;
stroke(lineStroke) ;
line(lineX,lineY,w,lineH);
line(lineX,lineY,lineW,lineH*2);
line(lineX,lineY+w,lineW,lineH*4);
line(lineX,lineY,lineW,lineH*6);
lineX= lineX +1;
lineY= lineY +1;
lineW= lineW - change;
lineH= lineH + change;
lineStroke = w + 1 ;
if ( lineX >= 200) {
lineX < 200;
}
}
so i wish that line is swimming till it is x=200 and then coming back to 0 position,
possible is im wrong and dont undrestend the way conditionals working.....but wish to understand
thanks for patience
lou
1
