xxxxxxxxxx
46
var vectors = [];
var parts = [];
var s = 10;
var clr;
function setup() {
createCanvas(600, 600);
angleMode(RADIANS);
// var off = random(3);
for(let x = 0; x < width; x += s) {
for(let y = 0; y < height; y += s) {
let n = noise(x/60, y/60)*TWO_PI;
let d = createVector(cos(n), sin(n));
vectors.push({x: x, y: y, dir: d});
}
}
for(let i = 0; i < width*0.75; i ++) {
parts.push(new Part(random(width), random(height)));
}
clr = 260.7; //260.7 50-120
while(clr > 50 && clr < 190) {clr = random(360);}
colorMode(HSB);
background(clr, 100, 100);
}
function draw() {
// for(let v of vectors) {
// stroke(0);
// line(v.x, v.y, v.x+v.dir.x*5, v.y+v.dir.y*5);
// }
for(let p of parts) {
p.update();
p.draw();
if(p.size <= 0) {
parts.splice(p, 1);
}
}
}
function mouseClicked() {
parts.length = 0;
setup();
}