It takes about 10 seconds to process the image. Tap to save screenshot.
A fork of Curvy by Richard Bourne
xxxxxxxxxx
// based on https://editor.p5js.org/kwertyops/sketches/0h5NIK-w-
p5.disableFriendlyErrors = true;
let shapes = [];
let circles = [];
//const colors = ["#FFD35C", "#FD4A8E", "#08A9E5", "#f0f0f0", "#202020"];
//const colors = ["#fcfcfc","#f52958","#fffae3","#2f9d90","#1d1c22"]; // maybe a better blue
//const colors = ["#264653","#2a9d8f","#f4a261","#e76f51"]; //
const colors = ["#001219","#0a9396","#94d2bd","#e9d8a6","#ee9b00","#ca6702","#bb3e03","#ae2012","#9b2226"];
const background_color = "#005f73"; //"#e9c46a"; //"#d2c8a7";
function setup() {
createCanvas(800, 800);
rectMode(CENTER);
generate();
}
function draw() {}
function generate() {
tiling();
shuffle(shapes, true);
background(background_color); //(random(colors));
stroke(0);
fill(255);
let hlen = int(shapes.length / 2);
for (let i = 0; i < circles.length; i++) {
let x = circles[i][0];
let y = circles[i][1];
let d = circles[i][2];
let col = color(random(colors));
let ac = TAU / (d * 12);
if (random() < 0.8) {
noStroke();
fill(col);
circle(x, y, d);
}
col.setAlpha(20);
noFill();
stroke(col);
for (let a = 0; a < TAU; a += ac) {
noiseCurve(x + d * 0.5 * cos(a), y + d * 0.5 * sin(a), 500, true, d);
}
}
shapes.length = 0;
circles.length = 0;
noiseSeed(int(random(100000)));
}
function tiling() {
let offset = 50;
let gridCountW = 10;
let gridCountH = gridCountW;
let gridW = (width - (offset * 2)) / gridCountW;
let gridH = (height - (offset * 2)) / gridCountH;
let empty = gridCountW * gridCountH;
let useGrid = [];
for (let j = 0; j < gridCountW; j++) {
let arr = []
for (let i = 0; i < gridCountH; i++) {
arr[i] = false;
}
useGrid[j] = arr;
}
while (empty > 0) {
let w = int(random(1, 5));
let h = int(random(1, 5));
let x = int(random(gridCountW - w + 1));
let y = int(random(gridCountH - h + 1));
let colision = true;
for (let j = 0; j < h; j++) {
for (let i = 0; i < w; i++) {
if (useGrid[x + i][y + j]) {
colision = false;
break;
}
}
}
if (colision) {
for (let j = 0; j < h; j++) {
for (let i = 0; i < w; i++) {
useGrid[x + i][y + j] = true;
}
}
let ww = w * gridW;
let hh = h * gridH;
let xx = offset + (x * gridW) + ww * 0.5;
let yy = offset + (y * gridH) + hh * 0.5;
if (ww != hh) {
shapes.push([xx, yy, ww, hh]);
} else {
circles.push([xx, yy, ww]);
}
empty -= w * h;
}
}
}
function noiseCurve(x, y, c, shall_recurse, d) {
let px = x;
let py = y;
beginShape();
for (let i = 0; i < c; i++) {
let scl = 0.0005;
let angle = noise(x * scl, y * scl, i * 0.0005) * 120;
let w = map(i, 0, c - 1, 1, 0);
vertex(x, y);
px = x;
py = y;
x += cos(angle) * 5;
y += sin(angle) * 5;
if(random() < 0.0001 && shall_recurse){
let ac = TAU / 12; //(d * 3);
for (let a = 0; a < TAU; a += ac) {
noiseCurve(x + d * 0.5 * atan(a), y + d * 0.5 * cos(a), 300, false, d/2);
}
}
}
endShape();
}
// save jpg
let lapse = 0; // mouse timer
function mousePressed(){
// prevents mouse press from registering twice
if (millis() - lapse > 400){
save("img_" + month() + '-' + day() + '_' + hour() + '-' + minute() + '-' + second() + ".jpg");
lapse = millis();
}
}