xxxxxxxxxx
105
let nscale = 200
let dens = 10;
let spots = [];
function setup() {
createCanvas(400, 400);
for(y = 0; y < height / dens; y++){
for(x = 0; x < width / dens; x++){
spots[spots.length] = new Spot1(x * dens, y * dens, spots.length);
spots[spots.length] = new Spot2(x * dens + dens * 0.25, y * dens + dens * 0.25, spots.length);
spots[spots.length] = new Spot3(x * dens + dens * 0.5, y * dens + dens * 0.5, spots.length);
spots[spots.length] = new Spot4(x * dens + dens * 0.75, y * dens + dens * 0.75, spots.length);
}
}
}
function draw() {
background(220);
for(i = 0; i < spots.length; i++){
stroke(0);
strokeWeight(1);
noFill();
spots[i].update();
}
noLoop();
}
class Spot1{
constructor(x, y, index){
this.x = x;
this.y = y;
this.index = index;
}
update(){
this.nf1 = noise(this.x / nscale, this.y / nscale, this.index / nscale);
this.nf2 = noise(this.x / nscale, this.index / nscale);
this.nf3 = noise(this.y / nscale, this.index / nscale);
if(this.nf1 > 0.2){
ellipse(this.x, this.y, this.nf2 * 20, this.nf3 * 20);
}
}
}
class Spot2{
constructor(x, y, index){
this.x = x;
this.y = y;
this.index = index;
}
update(){
this.nf1 = noise(this.x / nscale, this.y / nscale, this.index / nscale);
this.nf2 = noise(this.x / nscale, this.index / nscale);
this.nf3 = noise(this.y / nscale, this.index / nscale);
if(this.nf1 > 0.4){
ellipse(this.x, this.y, this.nf2 * 20, this.nf3 * 20);
}
}
}
class Spot3{
constructor(x, y, index){
this.x = x;
this.y = y;
this.index = index;
}
update(){
this.nf1 = noise(this.x / nscale, this.y / nscale, this.index / nscale);
this.nf2 = noise(this.x / nscale, this.index / nscale);
this.nf3 = noise(this.y / nscale, this.index / nscale);
if(this.nf1 > 0.6){
ellipse(this.x, this.y, this.nf2 * 20, this.nf3 * 20);
}
}
}
class Spot4{
constructor(x, y, index){
this.x = x;
this.y = y;
this.index = index;
}
update(){
this.nf1 = noise(this.x / nscale, this.y / nscale, this.index / nscale);
this.nf2 = noise(this.x / nscale, this.index / nscale);
this.nf3 = noise(this.y / nscale, this.index / nscale);
if(this.nf1 > 0.8){
ellipse(this.x, this.y, this.nf2 * 20, this.nf3 * 20);
}
}
}