xxxxxxxxxx
42
let randVal = [];
//let a=[#75e6da ,#828bc5, #e5fb52, #b1ff9e]
let pallete;
let url = "https://coolors.co/generate/75e6da-828bc5-e5fb52-b1ff9e";
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
pallete = createPallete(url);
for (let i = 0; i < 100; i++) {
randVal.push(random(100));
}
}
function draw() {
background(220);
noStroke();
let c = random(pallete);
fill(c);
for (let x = 0; x < 20; x++) {
for (let y = 0; y < 20; y++) {
if (randVal[x * y] > 30) {
ellipse(20 * x, 20 * y, 20);
}
}
noLoop();
}
// console.log(randVal[0]);
}
function createPallete(_url) {
let slash_index = _url.lastIndexOf("/");
let pallate_str = _url.slice(slash_index + 1);
let arr = pallate_str.split("-");
for (let i = 0; i < arr.length; i++) {
arr[i] = "#" + arr[i];
}
return arr;
}