xxxxxxxxxx
98
let lines;
let skulls;
let off;
function setup() {
createCanvas(800,800);
background(0)
off = width * 0.01;
lines = [];
for (let _ = 0; _ < 1000; _++) {
let a = random(-TWO_PI, TWO_PI);
lines.push({
sx:width/2,
sy:height/2,
// ex:width/2+width*cos(a),
// ey:height/2+height*sin(a),
col: random(255),
a: a,
step: random([-1,1]) * random(64,256),
off: random(1,10),
})
}
skulls = [];
textAlign(CENTER,CENTER);
// saveGif("perspective.gif", 10);
}
function draw() {
// background(220);
// background(0)
fill(0);
noStroke();
beginShape();
vertex(off,off);
vertex(width-off,off);
vertex(width-off,height-off);
vertex(off,height-off);
beginContour();
vertex(2*off,2*off);
vertex(2*off,height-2*off);
vertex(width-2*off, height-2*off);
vertex(width-2*off, 2*off);
endContour();
endShape(CLOSE);
for (let l of lines) {
stroke(color(l.col));
let ex = width/2 + width*cos(l.a);
let ey = height/2 + height*sin(l.a);
let col = color(l.col);
// fill(color(l.col));
col.setAlpha(map(120);
fill(col);
beginShape();
vertex(l.sx, l.sy);
vertex(ex, ey);
vertex(ex+l.off, ey);
endShape(CLOSE);
// line(l.sx, l.sy, ex,ey);
// l.a += PI/l.step;
l.a += PI/256;
}
push();
translate(width/2,height/2);
noStroke();
for (let i = skulls.length-1; i >= 0; i--) {
let sk = skulls[i];
let col = color(sk.col);
col.setAlpha(map(sk.sz, 1, width, 120, 10));//random(20,120));
fill(col);
textSize(sk.sz);
text(sk.g, 0, 0);
sk.sz += random(5, 20);
if (sk.sz > width) skulls.splice(i,1);
}
pop();
if (random() > 0.9) {
skulls.push({
col: random(255),
sz: 1,
g: random(["♥","☠"]),
});
}
}