xxxxxxxxxx
let particles = [];
let count;
let speed = 0.025;
class Particle {
constructor(x, y) {
this.x = x;
this.y = y;
this.x_noise = x;
this.y_noise = y;
this.size = 2;
this.delta = 0;
}
update() {
this.x_noise += speed;
this.y_noise += speed;
this.size = noise(this.x_noise, this.y_noise) * 10;
//this.size = random(0,10);
}
draw() {
noStroke();
fill(0,this.size*25.5,120);
rect(this.x, this.y, this.size, this.size);
}
}
function setup() {
createCanvas(600,600);
count = 0;
for(let x = 10; x < width; x += 10)
{
for(let y = 0; y < height; y += 10)
{
particles[count] = new Particle(x+5, y+10);
count++;
}
}
//print(count);
}
function draw() {
background(0);
//noiseSeed(deltaTime);
for(let i = 5; i < count ; i++)
{
particles[i].update();
particles[i].draw();
}
}