euglena/src/lineRotate.java

27 lines
857 B
Java
Raw Normal View History

2016-07-10 00:36:44 -07:00
float rotAngle = 0;
void lineRotate(float armLength, float speed){
clearDisplay();
strokeWeight(10); // Controls thickness of line
stroke(color(0, 0, 255));
fill(0,0,0);
if ((screenWidth - menu.width)/calibrator.magx - t > 2*armLength){
ellipseMode(CENTER);
ellipse(convertXCoord(centerX), convertYCoord(centerY),
(screenWidth - menu.width)/calibrator.magx - t, (screenWidth - menu.width)/calibrator.magx - t);
t = t + speed;
} else {
ellipseMode(CENTER);
ellipse(convertXCoord(centerX), convertYCoord(centerY), 2*armLength, 2*armLength);
line(convertXCoord(centerX), convertYCoord(centerY),
convertXCoord(centerX) + armLength*cos(rotAngle*PI/180), convertYCoord(centerY) + armLength*sin(rotAngle*PI/180));
rotAngle = rotAngle + speed;
}
}