xxxxxxxxxx
36
let x = [];
let y = [];
let num = 400;
function setup() {
createCanvas(windowWidth, windowHeight);
for(let i=0;i<num;i++) {
x.push(width/2);
y.push(height/2);
}
noStroke();
}
function draw() {
background(40);
for(let i=0;i<num;i++) {
let x1 = noise((frameCount+i*10) * 0.01,0.2)-0.5;
let y1 = noise(0.5,(frameCount+i*10) * 0.01)-0.5;
x[i] += x1*10;
y[i] += y1*10;
if(x[i] > width) x[i] = 0;
if(y[i] > height) y[i] = 0;
if(x[i] < 0) x[i] = width;
if(y[i] < 0) y[i] = height;
push();
translate(x[i], y[i]);
rotate(x[i] * 0.01);
fill(200,200,255,180);
textAlign(CENTER);
textSize(30);
//text("ok",0,0);
rect(0,0,2,100);
pop();
}
}