xxxxxxxxxx
//reference : R color palette package {MetBrewer} by Blake Robert Mills @BlakeRobMills
//https://github.com/BlakeRMills/MetBrewer/tree/main
let palette = [];
function setup() {
createCanvas(800, 800);
colorMode(HSB, 360, 100, 100, 100);
angleMode(DEGREES);
palette = random(MetPalettes).colors.concat();
}
function draw() {
background(0, 0, 90);
randomSeed(0);
let yStep = height / 10;
for (let oy = -height / 2; oy < height; oy += yStep) {
push();
translate(0, oy);
let colors = shuffle(palette.concat());
let gradient = drawingContext.createLinearGradient(
0,
-yStep,
0,
yStep
);
noStroke();
let c1 = color(colors[0]);
let c2 = color(colors[1]);
// c1.setAlpha(0);
gradient.addColorStop(0, c1);
gradient.addColorStop(1, c2);
drawingContext.fillStyle = gradient;
beginShape();
let arr = [];
let arr_len = int(random(2, 5));
for (let i = 0; i < arr_len; i++) {
arr.push({
type: random() > 0.5 ? sin : cos,
dir: random(1, 3) * (random() > 0.5 ? -1 : 1),
freq: random() * (random() > 0.5 ? -1 : 1),
});
}
for (let x = 0; x <= width + 1; x += 5) {
let d = yStep;
for (let obj of arr) {
let t = x + frameCount * obj.dir;
d *= obj.type(obj.freq * t);
}
let y = d;
vertex(x, y);
}
vertex(width + 1, height - oy + 1);
vertex(0, height - oy + 1);
endShape();
pop();
}
// noLoop();
}
MetPalettes = [
{
name: "Austria",
colors: [
"#a40000",
"#16317d",
"#007e2f",
"#ffcd12",
"#b86092",
"#721b3e",
"#00b7a7",
],
order: [1, 2, 3, 4, 6, 5, 7],
},
{
name: "Cassatt",
colors: [
"#b1615c",
"#d88782",
"#e3aba7",
"#edd7d9",
"#c9c9dd",
"#9d9dc7",
"#8282aa",
"#5a5a83",
],
order: [3, 6, 1, 8, 4, 5, 2, 7],
},
{
name: "Cross",
colors: [
"#c969a1",
"#ce4441",
"#ee8577",
"#eb7926",
"#ffbb44",
"#859b6c",
"#62929a",
"#004f63",
"#122451",
],
order: [4, 7, 1, 8, 2, 6, 3, 5, 9],
},
{
name: "Degas",
colors: [
"#591d06",
"#96410e",
"#e5a335",
"#556219",
"#418979",
"#2b614e",
"#053c29",
],
order: [5, 2, 4, 3, 7, 1, 6],
},
{
name: "Egypt",
colors: ["#dd5129", "#0f7ba2", "#43b284", "#fab255"],
order: [1, 2, 3, 4],
},
{
name: "Gauguin",
colors: ["#b04948", "#811e18", "#9e4013", "#c88a2c", "#4c6216", "#1a472a"],
order: [2, 5, 4, 3, 1, 6],
},
{
name: "Greek",
colors: ["#3c0d03", "#8d1c06", "#e67424", "#ed9b49", "#f5c34d"],
order: [2, 3, 5, 1, 4],
},
{
name: "Hokusai",
colors: [
"#6d2f20",
"#b75347",
"#df7e66",
"#e09351",
"#edc775",
"#94b594",
"#224b5e",
],
order: [2, 7, 4, 6, 5, 1, 3],
},
{
name: "Ingres",
colors: [
"#041d2c",
"#06314e",
"#18527e",
"#2e77ab",
"#d1b252",
"#a97f2f",
"#7e5522",
"#472c0b",
],
order: [4, 5, 3, 6, 2, 7, 1, 8],
},
{
name: "Isfahan1",
colors: [
"#4e3910",
"#845d29",
"#d8c29d",
"#4fb6ca",
"#178f92",
"#175f5d",
"#1d1f54",
],
order: [5, 2, 4, 6, 3, 7, 1],
},
{
name: "Isfahan2",
colors: ["#d7aca1", "#ddc000", "#79ad41", "#34b6c6", "#4063a3"],
order: [4, 2, 3, 5, 1],
},
{
name: "Juarez",
colors: ["#a82203", "#208cc0", "#f1af3a", "#cf5e4e", "#637b31", "#003967"],
order: [1, 2, 3, 4, 5, 6],
},
{
name: "Klimt",
colors: ["#df9ed4", "#c93f55", "#eacc62", "#469d76", "#3c4b99", "#924099"],
order: [5, 2, 3, 4, 6, 1],
},
{
name: "Manet",
colors: [
"#3b2319",
"#80521c",
"#d29c44",
"#ebc174",
"#ede2cc",
"#7ec5f4",
"#4585b7",
"#225e92",
"#183571",
"#43429b",
"#5e65be",
],
order: [8, 3, 10, 4, 7, 9, 11, 2, 6, 1, 5],
},
{
name: "Monet",
colors: [
"#4e6d58",
"#749e89",
"#abccbe",
"#e3cacf",
"#c399a2",
"#9f6e71",
"#41507b",
"#7d87b2",
"#c2cae3",
],
order: [2, 5, 8, 3, 4, 9, 1, 6, 7],
},
{
name: "Moreau",
colors: [
"#421600",
"#792504",
"#bc7524",
"#8dadca",
"#527baa",
"#104839",
"#082844",
],
order: [2, 5, 3, 4, 7, 1, 6],
},
{
name: "Morgenstern",
colors: [
"#7c668c",
"#b08ba5",
"#dfbbc8",
"#ffc680",
"#ffb178",
"#db8872",
"#a56457",
],
order: [6, 5, 4, 7, 3, 2, 1],
},
{
name: "Nattier",
colors: [
"#52271c",
"#944839",
"#c08e39",
"#7f793c",
"#565c33",
"#184948",
"#022a2a",
],
order: [1, 6, 5, 2, 3, 4, 7],
},
{
name: "NewKingdom",
colors: ["#e1846c", "#9eb4e0", "#e6bb9e", "#9c6849", "#735852"],
order: [2, 1, 3, 4, 5],
},
{
name: "Pillement",
colors: ["#a9845b", "#697852", "#738e8e", "#44636f", "#2b4655", "#0f252f"],
order: [4, 3, 2, 5, 1, 6],
},
{
name: "Pissaro",
colors: [
"#134130",
"#4c825d",
"#8cae9e",
"#8dc7dc",
"#508ca7",
"#1a5270",
"#0e2a4d",
],
order: [5, 2, 3, 6, 4, 7, 1],
},
{
name: "Redon",
colors: [
"#5b859e",
"#1e395f",
"#75884b",
"#1e5a46",
"#df8d71",
"#af4f2f",
"#d48f90",
"#732f30",
"#ab84a5",
"#59385c",
"#d8b847",
"#b38711",
],
order: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
},
{
name: "Renoir",
colors: [
"#17154f",
"#2f357c",
"#6c5d9e",
"#9d9cd5",
"#b0799a",
"#f6b3b0",
"#e48171",
"#bf3729",
"#e69b00",
"#f5bb50",
"#ada43b",
"#355828",
],
order: [2, 5, 9, 12, 3, 8, 7, 10, 4, 1, 6, 11],
},
{
name: "Robert",
colors: ["#11341a", "#375624", "#6ca4a0", "#487a7c", "#18505f", "#062e3d"],
order: [3, 2, 4, 5, 1, 6],
},
{
name: "Stevens",
colors: ["#042e4e", "#307d7f", "#598c4c", "#ba5c3f", "#a13213", "#470c00"],
order: [4, 2, 3, 5, 1, 6],
},
{
name: "Tara",
colors: ["#eab1c6", "#d35e17", "#e18a1f", "#e9b109", "#829d44"],
order: [1, 3, 2, 5, 4],
},
{
name: "Thomas",
colors: [
"#b24422",
"#c44d76",
"#4457a5",
"#13315f",
"#b1a1cc",
"#59386c",
"#447861",
"#7caf5c",
],
order: [3, 2, 8, 6, 1, 4, 7, 5],
},
{
name: "Tiepolo",
colors: [
"#802417",
"#c06636",
"#ce9344",
"#e8b960",
"#646e3b",
"#2b5851",
"#508ea2",
"#17486f",
],
order: [1, 2, 8, 6, 3, 5, 7, 4],
},
{
name: "Troy",
colors: [
"#421401",
"#6c1d0e",
"#8b3a2b",
"#c27668",
"#7ba0b4",
"#44728c",
"#235070",
"#0a2d46",
],
order: [2, 7, 4, 5, 1, 8, 3, 6],
},
{
name: "VanGogh1",
colors: [
"#2c2d54",
"#434475",
"#6b6ca3",
"#969bc7",
"#87bcbd",
"#89ab7c",
"#6f9954",
],
order: [3, 5, 7, 4, 6, 2, 1],
},
{
name: "VanGogh2",
colors: [
"#bd3106",
"#d9700e",
"#e9a00e",
"#eebe04",
"#5b7314",
"#c3d6ce",
"#89a6bb",
"#454b87",
],
order: [1, 5, 8, 2, 7, 4, 6, 3],
},
{
name: "Veronese",
colors: [
"#67322e",
"#99610a",
"#c38f16",
"#6e948c",
"#2c6b67",
"#175449",
"#122c43",
],
order: [5, 1, 7, 2, 3, 6, 4],
},
{
name: "Wissing",
colors: ["#4b1d0d", "#7c291e", "#ba7233", "#3a4421", "#2d5380"],
order: [2, 3, 5, 4, 1],
},
];