xxxxxxxxxx
/*
Emoji map #genuary30 #genuary #genuary2530
Abstract map.
https://openprocessing.org/sketch/2527278
#generativeart #creativecoding #p5js
*/
â
let pal, bg;
let R, areas;
â
function setup() {
createCanvas(windowWidth, windowHeight);
describe("emoji map of areas of houses, forest, water")
textAlign(CENTER, CENTER);
textSize(20);
frameRate(60);
noFill();
strokeWeight(2);
R = min(width, height) * 0.2;
pal = [palettes[frameCount%palettes.length]];
shuffle(pal, true);
bg = pal.shift();
areas = [];
addArea();
}
â
function draw() {
background(32);
if (frameCount % 100 === 0) {
addArea();
}
for (let a of areas) {
if (random()<0.1) a.addSign();
a.show();
}
drawMsg("emoji map (epi) #genuary2530");
}
â
function addArea(tries = 10) {
for (let i = 0; i < tries; i++) {
const x = random(width);
const y = random(height);
const r = random(R*0.2, R);
const c = random(pal);
const newArea = new Area(x, y, r, c);
if (!newArea.collides(areas, 10)) {
areas.push(newArea);
return true;
}
}
return false;
}
â
function drawMsg(msg) {
push();
blendMode(BLEND);
textSize(10);
fill("black")
noStroke();
textAlign(LEFT, TOP)
text(msg, 3, 2)
fill("white")
noStroke();
textAlign(LEFT, TOP)
text(msg, 2, 1)
â
pop();
}
â
function keyPressed() {
if (key === "s") {
// save(svg.split("\n"), "epi_noise_grid_circles.svg.txt");
}
}
â
function mousePressed() {
if (mouseButton != RIGHT) setup();
}