let canvas = createCanvas(800, 800);
colorMode(HSB, 360, 100, 100, 100);
palette = shuffle(random(colorScheme).colors.concat());
g = createGraphics(800, 800);
randomSeed(frameCount / 300);
let offset = g.width / 15;
let gw = sqrt(2) * g.width;
g.translate(g.width / 2, g.height / 2);
g.rotate(frameCount / 3);
g.translate(-gw / 2, -gw / 2);
separateGrid(-offset, -offset, gw + offset * 2, g);
drawingContext.shadowColor = color(0, 0, 0, 33);
drawingContext.shadowBlur = width / 25;
function separateGrid(x, y, d, target) {
let sepNum = int(random(1, 4));
for (let i = x; i < x + d - 1; i += w) {
for (let j = y; j < y + d - 1; j += w) {
if (random(100) < 90 && d > target.width / 3) {
separateGrid(i, j, w, target);
let colors = shuffle(palette.concat());
target.translate(i + w / 2, j + w / 2);
target.rotate((int(random(4)) * 360) / 4);
target.translate(-w / 2, -w / 2);
target.strokeCap(SQUARE);
for (let scl = 1; scl > 1 / 5 + 0.01; scl -= 1 / 5) {
let len = (scl * w * TWO_PI) / 4;
let step = int(random([1/3,1/4,1/2,1, 2, 3, 4, 8]));
target.strokeWeight(sw * 2);
target.stroke(colors[n++ % colors.length]);
target.drawingContext.setLineDash([ld]);
target.drawingContext.lineDashOffset =
ld * 2 + (frameCount * 1) / scl / 2;
target.arc(0, 0, w * 2 * scl - sw * 2, w * 2 * scl - sw * 2, 0, 90);
target.stroke(colors[n++ % colors.length]);
target.drawingContext.setLineDash([ld]);
target.drawingContext.lineDashOffset =
ld + (frameCount * 1) / scl / 2;
target.arc(0, 0, w * 2 * scl - sw * 2, w * 2 * scl - sw * 2, 0, 90);
colors: ["#F27EA9", "#366CD9", "#5EADF2", "#636E73", "#F2E6D8"],
colors: ["#D962AF", "#58A6A6", "#8AA66F", "#F29F05", "#F26D6D"],
colors: ["#222940", "#D98E04", "#F2A950", "#BF3E21", "#F2F2F2"],
colors: ["#1B618C", "#55CCD9", "#F2BC57", "#F2DAAC", "#F24949"],
colors: ["#074A59", "#F2C166", "#F28241", "#F26B5E", "#F2F2F2"],
colors: ["#023059", "#459DBF", "#87BF60", "#D9D16A", "#F2F2F2"],
colors: ["#632973", "#02734A", "#F25C05", "#F29188", "#F2E0DF"],
colors: ["#8D95A6", "#0A7360", "#F28705", "#D98825", "#F2F2F2"],
colors: ["#4146A6", "#063573", "#5EC8F2", "#8C4E03", "#D98A29"],
colors: ["#034AA6", "#72B6F2", "#73BFB1", "#F2A30F", "#F26F63"],
colors: ["#303E8C", "#F2AE2E", "#F28705", "#D91414", "#F2F2F2"],
colors: ["#424D8C", "#84A9BF", "#C1D9CE", "#F2B705", "#F25C05"],
colors: ["#D9D7D8", "#3B5159", "#5D848C", "#7CA2A6", "#262321"],
colors: ["#906FA6", "#025951", "#252625", "#D99191", "#F2F2F2"],