added spiral-form displaying

This commit is contained in:
Baipyrus 2022-06-04 23:01:18 +02:00
parent 3d43f58886
commit 220e0d5957

View File

@ -1,9 +1,9 @@
final float timeout = 2.5;
final float timeout = 5;
ArrayList<Integer> bars = new ArrayList<Integer>();
ArrayList<Job> queue = new ArrayList<Job>();
int mQL = 1, aQL = 0, amount;
float barWidth;
int mQL = 1, aQL = 0, amount = 500;
float barWidth = 10f;
int sortedFrameCountCapture = -1;
@ -11,10 +11,11 @@ void setup() {
fullScreen(P3D);
// size(1280, 720);
amount = floor(random(50, 500));
barWidth = (float)width / amount;
// amount = floor(random(100, 750));
// barWidth = (float)width / amount;
for (int i = 0; i < amount; i++) {
bars.add(round(random(height * 0.1, height * 0.9)));
bars.add(round(random(width/2)));
// bars.add(round(random(height * 0.1, height * 0.9)));
}
queue.add(new Job(0, amount-1));
@ -23,8 +24,9 @@ void setup() {
void draw() {
background(0);
stroke(0);
noStroke();
// stroke(0);
for (int i = 0; i < bars.size(); i++) {
// stroke(255);
fill(255);
@ -43,7 +45,12 @@ void draw() {
}
// line(i, height, i, height-bars.get(i));
// rect(i * barWidth, height, barWidth, -bars.get(i));
ellipse(i * barWidth + barWidth / 2, height - bars.get(i), barWidth, barWidth);
// ellipse(i * barWidth + barWidth / 2, height - bars.get(i), barWidth, barWidth);
final float a = map(i, 0, bars.size()-1, 0, 12*TWO_PI);
final float r = bars.get(i);
final float x = width/2 + cos(a) * r;
final float y = height/2 + sin(a) * r;
ellipse(x, y, barWidth, barWidth);
}
/*if (queue.size() > 0) {
@ -59,11 +66,12 @@ void draw() {
} else if (frameCount-sortedFrameCountCapture>=round((amount/2)*timeout)) {
sortedFrameCountCapture = -1;
amount = floor(random(50, 500));
barWidth = (float)width / amount;
// amount = floor(random(100, 750));
// barWidth = (float)width / amount;
bars = new ArrayList<Integer>();
for (int i = 0; i < amount; i++) {
bars.add(round(random(height * 0.1, height * 0.9)));
bars.add(round(random(width/2)));
// bars.add(round(random(height * 0.1, height * 0.9)));
}
queue.add(new Job(0, amount-1));
@ -76,8 +84,8 @@ void draw() {
mQL = max(queue.size(), mQL);
fill(255);
stroke(255);
fill(255,0,0);
stroke(255,0,0);
textAlign(LEFT, TOP);
textSize(width*0.022);
text("Queue Length: "+queue.size()+"; Max. Length: "+mQL+"; Absolute Length: "+aQL+"; Bar Amount: "+bars.size()+"; FPS: "+round(frameRate)+";", 0, 0);