xxxxxxxxxx
468
let i = 0;
let j = 0;
function setup() {
createCanvas(2700, 2700 * 3);
center = createVector(width / 2, height / 2);
cols = ["#0a9396","#94d2bd","#e9d8a6","#ee9b00","#ca6702","#bb3e03","#ae2012","#9b2226"];
d = pixelDensity();
curves = [];
count = 1;
ch = height / count;
r1 = random(100, 200);
r2 = random(100, 200);
r3 = random(100, 200);
r4 = random(100, 200);
r5 = random(100, 200);
r6 = random(100, 200);
r7 = random(100, 200);
r8 = random(100, 200);
for(i = 0; i < count; i++){
curves[i] = new Curve((width / 4) * (i + 2), (height / 4) * (i + 2), curves.length);
}
noFill();
strokeWeight(1);
background(0);
}
function draw() {
loadPixels();
for(j = 0; j < curves.length; j++){
curves[j].update();
}
}
class Curve {
constructor(x, y, index){
this.index = index;
this.center = createVector(x, y);
this.a1 = createVector(width / 2, height / 2);
this.arm = createVector(1, 0);
this.start = createVector(1, 0);
this.a2 = createVector(width / 2, y * index * ch + ch);
this.con = createVector(width / 2, y * index * ch + ch / 2 - height);
this.sp = createVector(100, 0);
this.dist = p5.Vector.sub(this.a1, center);
this.chance = 0;
this.check = 0;
this.test = 50;
this.c2 = createVector(0, 0);
this.rate = index;
this.pt1 = createVector(0, 0);
this.pt2 = createVector(0, 0);
this.pt3 = createVector(0, 0);
this.pt4 = createVector(0, 0);
this.pt5 = createVector(0, 0);
this.pt6 = createVector(0, 0);
this.s1 = 0;
this.s1 = 0;
this.s1 = 0;
this.s1 = 0;
this.s1 = 0;
this.s1 = 0;
this.timer = 0;
this.tover = 600;
this.sight = 0;
this.fail = false;
this.size = 0;
this.lcheck = random(1);
this.rev = 0;
this.c1 = floor(this.index);
this.c2 = (this.c1 + 1) % cols.length;
this.oc = this.c;
this.col = color(cols[this.c1 % cols.length]);
}
update(){
if(this.rev < cols.length * 10){
this.c2 = (this.c1 + 1) % cols.length;
if(this.lcheck > 0.5){
this.col = lerpColor(color(cols[this.c1]), color(cols[this.c2]), map(this.timer, 0, this.tover, 0, 1));
}
// this.col = color(255);
stroke(0);
fill(this.col);
this.a1 = p5.Vector.add(this.center, this.arm);
this.dist = p5.Vector.sub(this.a1, this.center);
this.size = map(noise(frameCount * 0.01), 0, 1, 1, 50)
this.sp.setMag(this.size);
// this.con.y = this.con.y + 1;
// noiseSeed(1);
// this.a1 = createVector(width / 2, height / 2);
// this.sp.setHeading(random(TWO_PI));
// this.sp.setMag((sin(this.con.y * 0.001 + this.index) + 1) * 50);
this.pt1 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt1 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt1.y)) * (d * width) + 4 * (d * floor(this.pt1.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt1 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt2 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt2 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt2.y)) * (d * width) + 4 * (d * floor(this.pt2.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt2 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt3 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt3 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt3.y)) * (d * width) + 4 * (d * floor(this.pt3.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt3 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt4 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt4 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt4.y)) * (d * width) + 4 * (d * floor(this.pt4.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt4 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt5 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt5 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt5.y)) * (d * width) + 4 * (d * floor(this.pt5.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
if(this.size >=1){
this.size--;
} else{
}
}
}
this.sp.setMag(this.size);
this.pt5 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt6 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt6 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt6.y)) * (d * width) + 4 * (d * floor(this.pt6.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt6 = p5.Vector.add(this.a1, this.sp);
// this.rate = this.rate - 1;
// this.rate = this.rate % 50;
// this.s1 = 4 * (d * floor(this.pt1.y)) * (d * width) + 4 * (d * floor(this.pt1.x));
// this.v1 = pixels[this.s1];
// this.s2 = 4 * (d * floor(this.pt2.y)) * (d * width) + 4 * (d * floor(this.pt2.x));
// this.v2 = pixels[this.s2];
// this.s3 = 4 * (d * floor(this.pt3.y)) * (d * width) + 4 * (d * floor(this.pt3.x));
// this.v3 = pixels[this.s3];
// this.s4 = 4 * (d * floor(this.pt4.y)) * (d * width) + 4 * (d * floor(this.pt4.x));
// this.v4 = pixels[this.s4];
// this.s5 = 4 * (d * floor(this.pt5.y)) * (d * width) + 4 * (d * floor(this.pt5.x));
// this.v5 = pixels[this.s5];
// this.s6 = 4 * (d * floor(this.pt6.y)) * (d * width) + 4 * (d * floor(this.pt6.x));
// this.v6 = pixels[this.s6];
// this.s7 = 4 * (d * floor(this.a1.y)) * (d * width) + 4 * (d * floor(this.a1.x));
// this.v7 = pixels[this.s7];
// this.chance = map(this.dist.mag(), 0, width + height, 0, 600);
// if(this.timer % this.test == true){
// this.test = this.timer + floor(random(50) + 50);
// this.chance = random(1);
// }
// print(this.fail);
if(this.fail == false){
// this.c = floor(random(cols.length));
// this.col = color(cols[this.c % cols.length]);
beginShape();
vertex(this.pt1.x, this.pt1.y);
vertex(this.pt2.x, this.pt2.y);
vertex(this.pt3.x, this.pt3.y);
vertex(this.pt4.x, this.pt4.y);
vertex(this.pt5.x, this.pt5.y);
vertex(this.pt6.x, this.pt6.y);
endShape(CLOSE);
// circle(this.a1.x, this.a1.y, this.sp.mag() / 2)
this.fail = false;
}
this.timer = this.timer + 1;
if(this.timer > this.tover){
this.arm.setMag(1);
this.start.setHeading(this.start.heading() + (TWO_PI / cols.length) + random(0.01));
this.arm.setHeading(this.start.heading());
this.c1 = (this.c1 + 1) % cols.length;
this.col = color(cols[this.c1 % cols.length]);
this.timer = 0;
this.lcheck = random(1);
this.rev = this.rev + 1
}
this.fail = false;
// bezier(this.a1.x, this.a1.y, this.c1.x, this.c1.y, this.c2.x, this.c2.y, this.a2.x, this.a2.y);
// bezier(this.a1.x, this.a1.y, this.c1.x + width / 2, this.c1.y, this.c2.x + width / 2, this.c2.y, this.a2.x, this.a2.y);
// circle(this.a1.x, this.a1.y, sin(this.con.y * 0.0023169 + this.index * 0.15) * 100)
// bezier(this.a3.x, this.a3.y, this.c1.x, this.c1.y, this.c2.x, this.c2.y, this.a4.x, this.a4.y);
// if(this.con.y - ch / 2 > height){
// this.con.y = 0 - ch / 2;
// }
} else{
this.c2 = (this.c1 + 1) % cols.length;
if(this.lcheck > 0.5){
this.col = lerpColor(color(cols[this.c1]), color(cols[this.c2]), map(this.timer, 0, this.tover, 0, 1));
}
// this.col = color(255);
stroke(this.col);
fill(this.col);
this.a1 = createVector(random(width), random(height));
this.dist = p5.Vector.sub(this.a1, this.center);
this.size = map(noise(frameCount * 0.01), 0, 1, 2, 10)
this.sp.setMag(this.size);
// this.con.y = this.con.y + 1;
// noiseSeed(1);
this.arm.setMag(this.arm.mag() + 1);
this.arm.setHeading(this.arm.heading() + 0.02 / (this.arm.mag() * 0.01));
// this.a1 = createVector(width / 2, height / 2);
// this.sp.setHeading(random(TWO_PI));
// this.sp.setMag((sin(this.con.y * 0.001 + this.index) + 1) * 50);
this.pt1 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt1 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt1.y)) * (d * width) + 4 * (d * floor(this.pt1.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt1 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt2 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt2 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt2.y)) * (d * width) + 4 * (d * floor(this.pt2.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt2 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt3 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt3 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt3.y)) * (d * width) + 4 * (d * floor(this.pt3.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt3 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt4 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt4 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt4.y)) * (d * width) + 4 * (d * floor(this.pt4.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt4 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt5 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt5 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt5.y)) * (d * width) + 4 * (d * floor(this.pt5.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt5 = p5.Vector.add(this.a1, this.sp);
this.sp.setHeading(this.sp.heading() + TWO_PI / 3);
this.pt6 = p5.Vector.add(this.a1, this.sp);
this.sight = this.size;
while(this.sight > 0){
this.pt6 = p5.Vector.add(this.a1, this.sp);
this.s1 = 4 * (d * floor(this.pt6.y)) * (d * width) + 4 * (d * floor(this.pt6.x));
this.v1 = pixels[this.s1];
if(this.v1 == 0){
this.sp.setMag(this.sp.mag() - 1);
this.sight = this.sight - 1;
} else{
this.sight = 0;
this.fail = true;
}
}
this.sp.setMag(this.size);
this.pt6 = p5.Vector.add(this.a1, this.sp);
// this.rate = this.rate - 1;
// this.rate = this.rate % 50;
// this.s1 = 4 * (d * floor(this.pt1.y)) * (d * width) + 4 * (d * floor(this.pt1.x));
// this.v1 = pixels[this.s1];
// this.s2 = 4 * (d * floor(this.pt2.y)) * (d * width) + 4 * (d * floor(this.pt2.x));
// this.v2 = pixels[this.s2];
// this.s3 = 4 * (d * floor(this.pt3.y)) * (d * width) + 4 * (d * floor(this.pt3.x));
// this.v3 = pixels[this.s3];
// this.s4 = 4 * (d * floor(this.pt4.y)) * (d * width) + 4 * (d * floor(this.pt4.x));
// this.v4 = pixels[this.s4];
// this.s5 = 4 * (d * floor(this.pt5.y)) * (d * width) + 4 * (d * floor(this.pt5.x));
// this.v5 = pixels[this.s5];
// this.s6 = 4 * (d * floor(this.pt6.y)) * (d * width) + 4 * (d * floor(this.pt6.x));
// this.v6 = pixels[this.s6];
// this.s7 = 4 * (d * floor(this.a1.y)) * (d * width) + 4 * (d * floor(this.a1.x));
// this.v7 = pixels[this.s7];
// this.chance = map(this.dist.mag(), 0, width + height, 0, 600);
// if(this.timer % this.test == true){
// this.test = this.timer + floor(random(50) + 50);
// this.chance = random(1);
// }
// print(this.fail);
if(this.fail == false && random(1) > 0.7){
// this.c = floor(random(cols.length));
// this.col = color(cols[this.c % cols.length]);
beginShape();
vertex(this.pt1.x, this.pt1.y);
vertex(this.pt2.x, this.pt2.y);
vertex(this.pt3.x, this.pt3.y);
vertex(this.pt4.x, this.pt4.y);
vertex(this.pt5.x, this.pt5.y);
vertex(this.pt6.x, this.pt6.y);
endShape(CLOSE);
// circle(this.a1.x, this.a1.y, this.sp.mag() / 2)
}else if(this.size > 0){
this.size = this.size - 1
}
this.timer = this.timer + 1;
if(this.timer > this.tover){
this.arm.setMag(1);
this.start.setHeading(this.start.heading() + (TWO_PI / cols.length) + random(0.01));
this.arm.setHeading(this.start.heading());
this.c1 = (this.c1 + 1) % cols.length;
this.col = color(cols[this.c1 % cols.length]);
this.timer = 0;
this.lcheck = random(1);
this.rev = this.rev + 1
}
this.fail = false;
}
this.oc = this.c1;
}
}