xxxxxxxxxx
103
let ww = 100;
let hh = 100;
let ro = 0;
let arr = [];
let cw = 5;
let cw2 = 900;
function setup() {
createCanvas(700, 700);
rectMode(CENTER);
angleMode(DEGREES);
}
function draw() {
background(0,20);
noFill();
stroke(255,100);
strokeWeight(1);
for(let j = 0; j < arr.length; j++){
arr[j].update();
if(arr[j].w < -600){
arr.splice(j,1);
// stroke(255,55);
//for(let i = 10; i < width; i += width/20){
// for(let j = 10; j < height; j += height/20){
// fill(255);
// }
//}
}
}
//for(let i = 10; i < width; i += width/20){
//for(let j = 10; j < height; j += height/20){
//fill(ccolor);
//ellipse(random(i,i+3),random(j,j+3),randomRadius,randomRadius);
//ccolor+=.5;
//}
//}
noFill();
noCursor();
stroke(0);
strokeWeight(5);
ellipse(mouseX, mouseY, cw, cw);
if(cw == 100){
cw=5;
}
cw+=.5;
strokeWeight(200);
ellipse(width/2,height/2,1250,1250);
strokeWeight(2);
stroke(255);
fill(255,10);
ellipse(width/2,height/2,cw2,cw2);
if(cw2 < -2250){
cw2 = 900;
}
cw2-=15;
}
function mouseDragged(){
let a = new AcidRain(mouseX,mouseY,cw,cw,2,mouseX,mouseY,ww,300);
arr.push(a);
}
class AcidRain{
constructor(x,y,w,h,speed,tw,th,osize,opacity){
//constructor(x,y,w,h){
this.x= x;
this.y= y;
this.w= w;
this.h= h;
this.speed = speed;
this.tw = tw;
this.th = th;
this.osize = osize;
this.opacity = opacity;
}
update(){
fill(0,this.opacity);
//translate(300,300);
ellipse(this.x,this.y,this.w,this.h);
if(this.h < 0 ){
fill(0,this.opacity);
this.opacity-=200;
}
if(this.w < -400){
this.w == 0;
this.h ==0;
}
this.w-=.5;
this.h-=.5;
}
}