xxxxxxxxxx
75
let x1_noise = 0.08;
let y1_noise = 0.1;
let x2_noise = 0.02;
let y2_noise = 0.01;
let x3_noise = 0.05;
let y3_noise = 0.04;
let x1_noise_inc;
let y1_noise_inc;
let x2_noise_inc;
let y2_noise_inc;
let x3_noise_inc;
let y3_noise_inc;
function setup() {
createCanvas(400, 400);
x1_noise_inc = random(0.1, 0.01);
y1_noise_inc = random(0.1, 0.01);
x2_noise_inc = random(0.1, 0.01);
y2_noise_inc = random(0.1, 0.01);
x3_noise_inc = random(0.1, 0.01);
y3_noise_inc = random(0.1, 0.01);
}
function draw() {
//noLoop();
// red color
let x1_location_value = map(noise(x1_noise), 0, 1, 0, width);
let y1_location_value = map(noise(y1_noise), 0, 1, 0, height);
let location_1 = {x:x1_location_value, y:y1_location_value};
// green color
let x2_location_value = map(noise(x2_noise), 0, 1, 0, width);
let y2_location_value = map(noise(y2_noise), 0, 1, 0, height);
let location_2 = {x:x2_location_value, y:y2_location_value};
// blue color
let x3_location_value = map(noise(x3_noise), 0, 1, 0, width);
let y3_location_value = map(noise(y3_noise), 0, 1, 0, height);
let location_3 = {x:x3_location_value, y:y3_location_value};
loadPixels();
for (x = 0; x < width; x++) {
for (y = 0; y < height; y++) {
let dist_color_1 = map(dist(x, y, location_1.x, location_1.y), 0, width, 0, 255);
let dist_color_2 = map(dist(x, y, location_2.x, location_2.y), 0, width, 0, 255);
let dist_color_3 = map(dist(x, y, location_3.x, location_3.y), 0, width, 0, 255);
set(x, y, color(dist_color_1, dist_color_2, dist_color_3));
}
}
updatePixels();
noStroke();
fill(255, 0, 0, 100);
ellipse(location_1.x, location_1.y, 25, 25);
fill(0, 255, 0, 100);
ellipse(location_2.x, location_2.y, 25, 25);
fill(0, 0, 255, 100);
ellipse(location_3.x, location_3.y, 25, 25);
noStroke();
x1_noise += x1_noise_inc;
y1_noise += y1_noise_inc;
x2_noise += x2_noise_inc;
y2_noise += y2_noise_inc;
x3_noise += x2_noise_inc;
y3_noise += x3_noise_inc;
}