Is it possible to pass colors as variables to the brain screen so that the color of a rectangle is a variable and is dependant on other factors?
sure, try this example.
int main() {
vex::color c;
int hue = 0;
Brain.Screen.setPenWidth(20);
while(1) {
// set color, use hue, saturation, value
c.hsv( hue, 1.0, 1.0 );
// increase hue, it's in range 0 to 360 degrees
hue = (hue + 5) % 360;
// set drawing color
Brain.Screen.setPenColor( c );
// draw rectangle
Brain.Screen.drawRectangle( 140, 20, 200, 200 );
// stops flicker at expense of lower update rate
Brain.Screen.render();
// Allow other tasks to run
//this_thread::sleep_for(16);
}
}
Thank you