xxxxxxxxxx
119
let cellsize;
const cc239 = ["#e0eff0", "#e3dd34", "#78496b", "#f0527f", "#a7e0e2"];
const mono = ["#202020", "#333333", "#666666", "#999999", "#cccccc"];
let palette, bg, curr_col;
let scribble;
let pts;
let hcs,qcs;
let gfx;
function setup() {
createCanvas(1000, 1000);
gfx = createGraphics(width, height);
angleMode(RADIANS)
pts = [];
scribble = new Scribble(gfx);
scribble.bowing = random(0.1,0.5);
scribble.roughness = random(0.5,3.0);//1.5;
scribble.numEllipseSteps = random(1,5);
let _gap = random(1.0, 5.0); //3.5;
let _angle = random(0, 360); //315;
let _angle2 = -_angle;
palette = random([cc239, mono]);
let idx = random(0, palette.length) | 0;
bg = palette[idx];
palette.splice(idx, 1);
cellsize = width * random([0.1, 0.05, 0.15]);// 0.01]);
hcs = cellsize / 2;
qcs = hcs/2;
background(color(bg));
gfx.background(color(bg));
if (random() > 0.5) gfx.noStroke();
for (let y = cellsize; y < height - cellsize; y += cellsize) {
for (let x = cellsize; x < width - cellsize; x += cellsize) {
if (random() > 0.5) {
gfx.strokeWeight(1.0);
gfx.stroke(color(random(palette)));
const xcoords = [x, x + cellsize, x + cellsize, x];
const ycoords = [y, y, y + cellsize, y + cellsize];
scribble.scribbleFilling(xcoords, ycoords, _gap, _angle);
// fill(color(random(palette)));
// rect(x,y,cellsize,cellsize);
} else if (random() > 0.75) {
let c = color(bg);
gfx.strokeWeight(0.5);
gfx.stroke(color(red(c) + 20, green(c) + 20, blue(c) + 20, 170));
const xcoords = [x, x + cellsize, x + cellsize, x];
const ycoords = [y, y, y + cellsize, y + cellsize];
scribble.scribbleFilling(xcoords, ycoords, _gap, _angle);
if (random() > 0.5)
pts.push({ x: x + hcs, y: y + hcs });
}
}
}
let c = color(bg);
// for (let i = 0; i < pts.length-2; i++) {
// let p = pts[i];
// let p2 = pts[i+1];
// scribble.scribbleLine(p.x,p.y,p2.x,p2.y);
// }
for (let p of pts) {
gfx.stroke(color(red(c) + 20, green(c) + 20, blue(c) + 20, 170));
gfx.strokeWeight(random(1.5,qcs));
let njoints = random(1, 10);
for (let i = 0; i < njoints; i++) {
let _x2 = p.x + random(-3,3);
let _y2 = p.y - random(5, 15);
if (_y2 < cellsize || _x2 < cellsize || _x2 > width-cellsize) continue;
scribble.scribbleLine(p.x,p.y,_x2,_y2);
p.y = _y2;
p.x = _x2;
}
let nsteps = random(3,50);
let xcoords = [];
let ycoords = [];
gfx.strokeWeight(1.0);
if (random() > 0.8)
gfx.stroke(random([color(255,0,0),color(0,255,0),color(255,0,255)]));
else
gfx.stroke(color(random(palette)))
p.y -= hcs;
for (let t = 0; t < TWO_PI; t += TWO_PI/nsteps) {
xcoords.push(p.x+hcs*cos(t));
ycoords.push(p.y+hcs*sin(t));
}
if (random() > 0.5)
scribble.scribbleEllipse(p.x,p.y,hcs*2,hcs*2);
scribble.scribbleFilling(xcoords, ycoords, _gap, _angle2);
}
imageMode(CENTER);
translate(width/2,height/2);
// rotate(PI);
image(gfx,0,0);
tint(255,250);
image(gfx,-3,-3);
}
function draw() {
noLoop();
}