linking values with different range
in
Programming Questions
•
1 year ago
here lines y and y1 values are min 0, max 576 (height)
fill values are from 0 to 255
how do you link those two
so that line reach maximum aka i%height in the same time as fill reaches 255
???
int d=5;
int i=0;
void setup(){
size(768,576);
smooth();
frameRate(12);
}
void draw(){
i=i+d;
fill(0,0,0,50);
rectMode(CORNER);
rect(0,0,width/2,height);
stroke(255);
line(0,i%height,width/2,i%height);
fill(i%height,0,0);
rect(width/2,0,width/2, height);
}
fill values are from 0 to 255
how do you link those two
so that line reach maximum aka i%height in the same time as fill reaches 255
???
int d=5;
int i=0;
void setup(){
size(768,576);
smooth();
frameRate(12);
}
void draw(){
i=i+d;
fill(0,0,0,50);
rectMode(CORNER);
rect(0,0,width/2,height);
stroke(255);
line(0,i%height,width/2,i%height);
fill(i%height,0,0);
rect(width/2,0,width/2, height);
}
1