xxxxxxxxxx
function setup() {
createCanvas(w=720, h=w);
colorMode(HSB);
background(98);
push();
strokeWeight(1);
stroke(10, 0.25);
translate(w/2, h/2);
//de Jong Attractor Parameter
let a = -1.4;
let b = 1.4;
let c = 1.7;
let d = -1.4;
//Flow Field Parameter
let noise_input_x = [0.8, 0.9, 0.5];
let noise_input_y = [0.9, 0.8, 0.6];
let noise_weight = 0.25;
//Draw Parameter
let draw_scale = 150;
let N = 100000;
let x = random(-1,1);
let y = random(-1,1);
for(let i=0;i<N;i++){
let dx = sin(y*a) + cos(x*b);
let dy = sin(x*c) + cos(y*d);
dx += cos(TAU*noise(x*noise_input_x[0], y*noise_input_x[1], noise_input_x[2])) * noise_weight;
dy += sin(TAU*noise(x*noise_input_y[0], y*noise_input_y[1], noise_input_y[2])) * noise_weight;
point(draw_scale * dx, draw_scale * dy);
x = dx;
y = dy;
}
pop();
}
//save PNG
function keyPressed() {
let name = "img_" + month() + day() + hour() + minute() + second();
save(name + ".png");
}