This is my take on it. Here’s my forked version:
/**
* Tadpoles (v1.0.1) [Java/Pjs]
*
* p5.js by Srdjan Markovi.ch (2016/Oct/13)
* https://OpenProcessing.org/sketch/386063
*
* Pjs fork by GoToLoop (2021/Jun/29)
* https://OpenProcessing.org/sketch/1226376
*
* https://Discourse.Processing.org/t/
* problems-with-converting-a-p5-js-sketch-to-processing/30963/4
*/
final Tadpole[] tadpoles = new Tadpole[120];
void setup() {
size(500, 500);
noStroke();
for (int i = 0; i < tadpoles.length; tadpoles[i++] = new Tadpole());
}
void draw() {
background(-1);
for (final Tadpole tadpole : tadpoles) tadpole.update().display();
}
class Tadpole {
final PVector prevs[] = new PVector[10], pos = new PVector();
float t = random(10000), ts = random(100);
Tadpole() {
for (int i = 0; i < prevs.length; prevs[i++] = new PVector());
}
Tadpole update() {
final float tts = t + ts;
t += .005;
pos.set(noise(tts) * width, noise(tts + 100) * height);
prevs[0].set(pos);
return this;
}
Tadpole display() {
fill(0);
ellipse(pos.x, pos.y, 4, 4);
fill(20, 50, 0, 10);
for (int i = prevs.length; --i > 0; ) {
final PVector curr = prevs[i];
final int diam = 14 - i;
curr.set(prevs[i - 1]);
ellipse(curr.x, curr.y, diam, diam);
}
return this;
}
}