euglena/src/protoGather.java

34 lines
1.4 KiB
Java
Raw Normal View History

2016-07-10 00:36:44 -07:00
/*
\__ Draws shape like this and activates arduino so that
-> __| euglena stream into the opening. The top coordinates of the top right
/ x and y and width and height of containment box can be passed as parameters
After amount of time or (yet to be implemented) after number of euglena
enter the box is closed
*/
float t_temp = 0;
float t = 0;
void protoGather(float x, float y, float boxWidth, float boxHeight) {
noFill();
strokeWeight(10); // Controls thickness of blue border
stroke(color(0, 0, 220));
beginShape(); // Draws shape
vertex(convertXCoord(x - menu.width), displayHeight*calibrator.offsety+displayHeight/calibrator.magy-10);
vertex(convertXCoord(x), convertYCoord(y));
vertex(convertXCoord(x + boxWidth), convertYCoord(y));
vertex(convertXCoord(x + boxWidth), convertYCoord(y + boxHeight));
vertex(convertXCoord(x), convertYCoord(y + boxHeight));
vertex(convertXCoord(x - menu.width), displayHeight*calibrator.offsety);
endShape();
if (t < 180) {
arduino.analogWrite(down, 64); // Turns on arduino light (can make ledPin into a parameter that is passed in)
} else {
arduino.analogWrite(down, 0);
}
t_temp = t_temp + 1;
t = t_temp / framerate;
}