class Arrow {
int id, posX, posY, colorofarrow, w, h, thickness, angle, alpha;
Arrow(int id, int posX, int posY, int w, int h, int thickness, int angle, int colorofarrow, int alpha) {
this.id = id;
this.posX = posX;
this.posY = posY;
this.w = w;
this.h = h;
this.thickness = thickness;
this.angle = angle;
this.colorofarrow = colorofarrow;
this.alpha = alpha;
}
void drawArrow(boolean mirrorX, boolean mirrorY) {
float drawAngle = radians(angle);
int x = posX;
int y = posY;
if (mirrorX) {
x = width / 2 - (posX - width / 2);
drawAngle = -drawAngle;
}
if (mirrorY) {
y = height / 2 - (posY - height / 2);
drawAngle = -drawAngle;
}
int fill_color_selector = ceil(map(colorofarrow, 1, 101, 0, 3));
int alphavalue = floor(map(alpha,1,101,120,180));
int id, posX, posY, colorofarrow, w, h, thickness, angle, alpha;
Arrow(int id, int posX, int posY, int w, int h, int thickness, int angle, int colorofarrow, int alpha) {
this.id = id;
this.posX = posX;
this.posY = posY;
this.w = w;
this.h = h;
this.thickness = thickness;
this.angle = angle;
this.colorofarrow = colorofarrow;
this.alpha = alpha;
}
void drawArrow(boolean mirrorX, boolean mirrorY) {
float drawAngle = radians(angle);
int x = posX;
int y = posY;
if (mirrorX) {
x = width / 2 - (posX - width / 2);
drawAngle = -drawAngle;
}
if (mirrorY) {
y = height / 2 - (posY - height / 2);
drawAngle = -drawAngle;
}
int fill_color_selector = ceil(map(colorofarrow, 1, 101, 0, 3));
int alphavalue = floor(map(alpha,1,101,120,180));
switch(fill_color_selector) {
case 1:
int r = floor(random(2));
if (r==0){
fill(240, 180, 91, alphavalue); stroke(240, 180, 91, 255); break;
}
else {
int r2 = floor(random(2));
if(r2==0){
fill(44, 41, 98, alphavalue); stroke(44, 41, 98, 255); break;
} else {
fill(221, 85, 70, alphavalue); stroke(221, 85, 70, 255); break;
}
}
case 2:
fill(44, 41, 98, alphavalue); stroke(44, 41, 98, 255); break;
case 3:
fill(221, 85, 70, alphavalue); stroke(221, 85, 70, 255); break;
}
strokeWeight(int(random(2,5)));
pushMatrix();
translate(x, y);
scale(0.8);
rotate(drawAngle);
beginShape();
vertex(0, -thickness * 0.5);
vertex(-w * 0.5, -thickness * 0.5);
vertex(-w * 0.5, thickness * 0.5);
vertex(0, thickness * 0.5);
vertex(0, h * 0.5);
vertex(w * 0.5, 0);
vertex(0, -h * 0.5);
endShape(CLOSE);
popMatrix();
}
}