xxxxxxxxxx
54
function setup() {
createCanvas(400, 400);
// rectMode(CENTER);
}
function draw() {
background(40);
fill(0,0,255);
noStroke();
let speed = 0.04;
fill(255);
push();
// sin -1 1
// tan
let a = sin(frameCount * 0.01) * 140;
translate(200,200 + a);
randomSeed(20);
let n = 32;
for(let i=0;i<n;i=i+1) {
push();
rotate(map(i,0,n,0,TWO_PI));
rect(30,0,random()*200,3);
pop();
}
pop();
b = tan(frameCount * 0.1) * 100;
push();
translate(100 + b,200);
rect(0,0,100,100);
pop();
for(let i=0;i<100;i=i+1) {
fill(0,i*4,255);
push();
translate(200,i * 10);
rotate((frameCount+i*2) * -speed)
translate(-300/2,-100/2);
rect(0,0,100,2);
pop();
}
push();
translate(width/2,height/2);
fill(255,0,0);
// ellipse(0,0,100,100);
pop();
}