xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
noStroke();
blendMode(ADD);
rectMode(CENTER);
background(20);
for(let i=0;i<200;i++){
drawSolar();
}
for(let i=0;i<6000;i++){
drawDust();
}
}
let colorList = [
[40, 119, 247],
[82, 40, 250],
[235, 140, 23],
[255, 236, 23]
];
let middleRectRotate = 0;
let middleRectSize = 100;
function draw() {
if(frameCount%10===0){
if(middleRectSize < 400){
middleRectSize += 1;
}
drawSolar();
}
for(let i=0;i<5;i++){
drawDust();
drawBlack();
}
}
function drawSolar(){
push();
fill(255,1);
translate(width/2,height/2);
middleRectRotate += TWO_PI/360;
rotate(middleRectRotate);
rect(0,0,middleRectSize);
pop();
}
function drawDust(){
let pickColor = random(colorList);
let clr = color(pickColor[0],pickColor[1],pickColor[2], random(64,255));
fill(clr);
let x = random(width);
let y = random(height);
let rScale = 0.9-(dist(x,y,width/2,height/2)/dist(0,0,width/2,height/2));
let r = random(2,30) * max(rScale,0);
let shapeType = random(3);
if(shapeType<1){
ellipse(x, y, r);
}
else if(shapeType<2){
rect(x, y, r);
}
else if(shapeType<3){
push();
stroke(clr);
translate(x,y);
rotate(random(TWO_PI));
line(0,0, r/2,0);
pop();
}
}
function drawBlack(){
push();
blendMode(BLEND);
fill(0,0,0,30);
noStroke();
translate(width/2,height/2);
rotate(random(TWO_PI));
rect(width*random(0.45,0.7),0,random(10,30));
pop();
}