xxxxxxxxxx
let shapes = [];
let shapesNum = 800;
let pgemoji;
const stDist = 45;
const emojiArray = [129412, 127904, 127853, 129436, 129344];
function setup() {
createCanvas(800, 600);
angleMode(DEGREES);
pgemoji = createGraphics(width, height);
pgemoji.background(255);
pgemoji.textAlign(CENTER, CENTER);
pgemoji.textSize(600);
pgemoji.text(String.fromCodePoint(random(emojiArray)), pgemoji.width / 2, pgemoji.height / 2);
for (let i = 0; i < shapesNum; i++) {
shapes.push(new Shape());
}
noLoop();
}
function draw() {
background("#E7ECF2");
for (let i = 0; i < shapes.length; i++) {
for (let j = 0; j < shapes.length; j++) {
if (i != j && dist(shapes[i].x, shapes[i].y, shapes[j].x, shapes[j].y) < stDist) {
let sc = color(shapes[i].c);
sc.setAlpha(50);
stroke(sc);
line(shapes[i].x, shapes[i].y, shapes[j].x, shapes[j].y);
}
}
}
}
class Shape {
constructor() {
this.init();
}
init() {
this.x = random(width);
this.y = random(height);
this.c = pgemoji.get(this.x, this.y);
if (brightness(this.c) > 99) {
this.init();
}
}
display() {
circle(this.x, this.y, 3);
}
}