I am making my first steps in P5.js, and trying to translate some js to java code, but I don’t understand the function below. It seems some nested function. How can I translate this?
let particles = [];
function draw() {
for (let p of particles) {
p.draw();
p.move();
}
if (frameCount % 20 === 0) {
updateParticles();
}
}
function Particle(x_, y_, s_, c_) {
this.x = x_;
this.y = y_;
this.size = s_;
this.c = c_;
this.dist = 1;
this.move = function() {
let theta = noise(this.x * sness,
this.y * sness)*PI*4;
let v = p5.Vector.fromAngle(theta, this.dist);
this.x += v.x;
this.y += v.y;
//this.dist *= 0.9;
//this.size *= 0.99;
}
this.draw = function() {
fill(this.c);
circle(this.x, this.y, this.size);
}
}