This commit is contained in:
Baipyrus 2022-08-16 10:03:18 +02:00
parent 220e0d5957
commit 9dbe07a10c
2 changed files with 37 additions and 28 deletions

View File

@ -1,4 +1,4 @@
final int amount = 100; final int amount = 250;
final float timeout = 2.5; final float timeout = 2.5;
ArrayList<Integer> bars; ArrayList<Integer> bars;
@ -13,8 +13,8 @@ float tenPercentHeight;
float ninetyPercentHeight; float ninetyPercentHeight;
void setup() { void setup() {
// fullScreen(); fullScreen(P3D);
size(1280, 720, P3D); // size(1280, 720, P3D);
distance = amount-1; distance = amount-1;
tenPercentHeight = height * 0.1; tenPercentHeight = height * 0.1;
@ -25,7 +25,7 @@ void setup() {
} }
barWidth = (float)width / amount; barWidth = (float)width / amount;
frameRate(120); frameRate(250);
} }
void draw() { void draw() {

View File

@ -1,22 +1,37 @@
final float timeout = 5; final float timeout = 2;
ArrayList<Integer> bars = new ArrayList<Integer>(); ArrayList<Integer> bars = new ArrayList<Integer>();
ArrayList<Job> queue = new ArrayList<Job>(); ArrayList<Job> queue = new ArrayList<Job>();
int mQL = 1, aQL = 0, amount = 500; int mQL = 1, aQL = 0, amount = 100;
float barWidth = 10f; float barWidth = 10f;
int sortedFrameCountCapture = -1; int sortedFrameCountCapture = -1;
void init() {
amount = floor(random(100, 750));
barWidth = (float)width / amount;
bars = new ArrayList<Integer>();
for (int i = 0; i < amount; i++) {
// bars.add(round(map(i,0,amount-1,0,width/2)));
// bars.add(round(random(width/2)));
bars.add(round(random(height * 0.1, height * 0.9)));
}
// int counter = 0;
// while (counter < 2*amount) {
// int i = floor(random(bars.size()));
// int j = floor(random(bars.size()));
// int t = bars.get(i);
// bars.set(i, bars.get(j));
// bars.set(j, t);
// counter++;
// }
}
void setup() { void setup() {
fullScreen(P3D); fullScreen(P2D);
// size(1280, 720); // size(1280, 720);
// amount = floor(random(100, 750)); init();
// barWidth = (float)width / amount;
for (int i = 0; i < amount; i++) {
bars.add(round(random(width/2)));
// bars.add(round(random(height * 0.1, height * 0.9)));
}
queue.add(new Job(0, amount-1)); queue.add(new Job(0, amount-1));
frameRate(amount); frameRate(amount);
@ -26,7 +41,7 @@ void draw() {
background(0); background(0);
noStroke(); noStroke();
// stroke(0); stroke(0);
for (int i = 0; i < bars.size(); i++) { for (int i = 0; i < bars.size(); i++) {
// stroke(255); // stroke(255);
fill(255); fill(255);
@ -44,13 +59,13 @@ void draw() {
} }
} }
// line(i, height, i, height-bars.get(i)); // line(i, height, i, height-bars.get(i));
// rect(i * barWidth, height, barWidth, -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 a = map(i, 0, bars.size()-1, 0, 12*TWO_PI);
final float r = bars.get(i); // final float r = bars.get(i);
final float x = width/2 + cos(a) * r; // final float x = width/2 + cos(a) * r;
final float y = height/2 + sin(a) * r; // final float y = height/2 + sin(a) * r;
ellipse(x, y, barWidth, barWidth); // ellipse(x, y, barWidth, barWidth);
} }
/*if (queue.size() > 0) { /*if (queue.size() > 0) {
@ -63,16 +78,10 @@ void draw() {
if (queue.size() == 0) { if (queue.size() == 0) {
if (sortedFrameCountCapture == -1) { if (sortedFrameCountCapture == -1) {
sortedFrameCountCapture = frameCount; sortedFrameCountCapture = frameCount;
} else if (frameCount-sortedFrameCountCapture>=round((amount/2)*timeout)) { } else if (frameCount-sortedFrameCountCapture>=round(frameRate*timeout)) {
sortedFrameCountCapture = -1; sortedFrameCountCapture = -1;
// amount = floor(random(100, 750)); init();
// barWidth = (float)width / amount;
bars = new ArrayList<Integer>();
for (int i = 0; i < amount; i++) {
bars.add(round(random(width/2)));
// bars.add(round(random(height * 0.1, height * 0.9)));
}
queue.add(new Job(0, amount-1)); queue.add(new Job(0, amount-1));
mQL = 1; mQL = 1;