You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
815 B
Java

float speed;
float x_current = 0;
void angleMove(float x, float y, float angle, float armLength, float speed) {
clearDisplay();
arduino.digitalWrite(right, arduino.HIGH);
noFill();
strokeWeight(20); // Controls thickness of blue border
stroke(color(0, 0, 255));
beginShape(); // Draws shape
vertex(convertXCoord(x - x_current + armLength*cos(angle*PI/360)), convertYCoord(y + armLength*sin(angle*PI/360)));
vertex(convertXCoord(x - x_current), convertYCoord(y));
vertex(convertXCoord(x - x_current + armLength*cos(angle*PI/360)), convertYCoord(y - armLength*sin(angle*PI/360)));
endShape(CLOSE);
if (x_current < displayWidth-menu.width){
x_current = x_current + 1*speed;
} else {
x_current = 0;
}
}