xxxxxxxxxx
//noprotect
let xx,yy, c;
let angle = 0;
let noiseValue = 0;
let seed = Math.random() * 99999999;
let bd = 1.5;
let bd2 = bd * 2;
async function setup() {
wis = min(windowWidth,windowHeight);
c = createCanvas(wis,wis);
randomSeed(seed);
noiseSeed(seed);
noFill();
pixelDensity(2);
background(20);
blendMode(SCREEN);
let gridSize = 1;
let radius = width / 4;
let centerX = width / 2;
let centerY = height / 2;
xoff = 0;
for (let x = 0; x <= width; x += gridSize) {
yoff = 0;
for (let y = 0; y <= height; y += gridSize) {
let dx = x - centerX;
let dy = y - centerY;
if (dx * dx + dy * dy <= radius * radius) {
let nx = map(x, 0, width, 0, 1);
let ny = map(y, 0, height, 0, 1);
let noiseValue = noise(nx, ny);
let angle = map(noiseValue, 0, 1, 0, TWO_PI*2);
let lineLength = gridSize * 10;
let px = x + cos(angle) * lineLength;
let py = y + tan(angle) * lineLength;
let v1 = createVector(x, y);
let v2 = createVector(xx, yy);
push();
stroke(240, 25);
strokeWeight(0.05);
drawingContext.setLineDash([random(0,10), random(0,10), random(0,10), random(0,10), random(0,10)]);
//ellipseMode(CORNER);
//ellipse(x, y, px - py);
//ellipseMode(CORNERS);
//ellipse(v1.x, v1.y, py - px);
//stroke(180, 25);
//strokeWeight(0.1);
//rect(x, y, px - py);
line(v1.x, v1.y, px, py);
line(v2.x, v2.y, px, py);
line(v1.y, v1.x, py, px);
line(v2.y, v2.x, py, px);
//circle(x, y, px - py);
//circle(px, py, x + y);
pop();
push();
rotate(PI);
//translate(-width,-height);
stroke(0, 60);
strokeWeight(0.05);
//line(x, y, px, py);
//ellipse(px, py, x + y);
pop();
xx = x;
yy = y;
}
yoff += 0.05;
}
if (x >= width) {
k = random(-50,50);
push();
imageMode(CENTER);
rotate(-QUARTER_PI/random(1,2));
translate(wis*0.2, wis*0.6);
epingle(k);
pop();
push();
imageMode(CENTER);
rotate(QUARTER_PI/random(3,4));
translate(wis*0.5,wis*0.5);
epingle(k);
pop();
}
xoff += 0.05;
await sleep(1);
}
boxBorder();
}
function draw() {
}
function epingle(variance) {
push();
blendMode(SCREEN);
fill(255);
triangle(0, 0, 0, 10, -15, 15);
rect(0,0,80,10);
triangle(80, 0, 80, 10, 95, 15);
stroke(0);
fill(0,255);
circle(10,2.5,5);
circle(47.5,2.5,5);
circle(70,2.5,5);
pop();
}
function boxBorder() {
push();
noFill();
stroke(220);
strokeWeight(bd * 1.3);
line(0, bd/2, width + bd, bd/2);
line(bd/2, 0, bd/2, width + bd);
line(0, height - bd/2, width, height - bd/2);
line(width - bd/2, 0, width - bd/2, height);
fill(180);
for (let i = 0; i < width; i += random(bd,bd2)) {
square(+i*2, 0, random(bd,bd2));
square(+i*2, height, -random(bd,bd2));
}
for (let i = 0; i < height; i += random(bd,bd2)) {
square(0, +i*2, random(bd,bd2));
square(width, +i*2, -random(bd,bd2));
}
pop();
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function keyTyped() {
let keyLower = key.toLowerCase();
if (keyLower === "r") {
clear();
await setup();
} else if (keyLower === "s") {
saveCanvas(`ossature_cce_` + random(100), 'png');
} else if (!isNaN(keyLower)) {
await pixDens(Number(keyLower));
}
}