xxxxxxxxxx
138
let rbs = [];
let drops = [];
p = 0;
ym = 0;
p2 = 0;
aw = 0
function setup() {
angleMode(DEGREES);
background(0);
createCanvas(windowWidth, windowHeight);
for (let i = 0; i < 500; i++) {
drops[i] = new Drop();
}
}
function draw() {
//fade effect
fill(0, 10);
rect(0, 0, width, height);
//left arc
strokeWeight(1);
//stroke(0,255,0);
noFill();
arc(width / 2, ym, aw, 80, 0, p, OPEN);
p = p + PI;
//center arc
//fill(7,18,60,10);
arc(width / 1.25, ym, aw, 40, 0, p, OPEN);
ym = ym + 2;
p = p + PI;
//right arc
arc(width / 5, ym, aw, 40, 0, p2, OPEN);
//fill(255, 225, 225, 50);
if (ym > windowHeight+250) {
ym = 0;
}
p2 = p2 + PI;
aw = aw + random(.5, 10);
if (aw > 250) {
aw = aw * -1;
}
//drops
for (let i = 0; i < drops.length; i++) {
drops[i].fall();
drops[i].show();
}
if (this.y2 > 10) {
function Drop() {
this.z2 = random(0, 20);
this.y2speed = map(this.z2, 0, 20, 1, 20);
}
}
//glitch
for (let i = 0; i < rbs.length; i = i + 1) {
rbs[i].update();
}
}
function Drop() {
this.x2 = random(width);
this.y2 = random(-600, -50);
this.z2 = random(0, 60);
this.y2speed = map(this.z2, 0, 20, 1, 20);
this.grav = random(0, 0.2);
this.fall = function() {
this.y2 = this.y2 = this.y2speed;
this.y2speed = this.y2speed + this.grav;
if (this.y2 > height) {
this.y2 = random(-200, -100);
this.y2speed = map(this.z2, 0, 20, 4, 10);
}
} //Daniel Shiffman
this.show = function() {
strokeWeight(random(.5,2));
stroke(255, 255, 255, random(10, 100));
line(this.x2, this.y2, this.x2, this.y2);
}
}
//gltich
function mouseDragged() {
let w = random(1, 5);
let h = w;
let rb = new RotatorBouncer(
mouseX, // x
mouseY, // y
w, // width
h, // height
2, // xspeed
2, // yspeed
.01 // rspeed
);
rbs.push(rb);
}
class RotatorBouncer {
constructor(x, y, w, h, xSpeed, ySpeed) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.xSpeed = xSpeed;
this.ySpeed = ySpeed;
}
update() {
push();
translate(this.x, this.y);
stroke(random(255),random(255),random(255),random(80,100));
noFill();
rect(0, 0, this.w, this.h);
pop();
this.x = this.x + this.xSpeed;
if (this.x > width - this.w / 2 || this.x < this.w / 2) {
this.xSpeed = this.xSpeed * -1;
}
if (this.y > height - this.h / 2 || this.y < this.h / 2) {
this.ySpeed = this.ySpeed * -1;
}
}}