Skip to content

Instantly share code, notes, and snippets.

@volfegan
Last active May 2, 2021 22:10
Show Gist options
  • Save volfegan/d7a905b9839d7db477dfb548fd43a865 to your computer and use it in GitHub Desktop.
Save volfegan/d7a905b9839d7db477dfb548fd43a865 to your computer and use it in GitHub Desktop.
A mandala made from OR triangles overflow from the centre in a XOR munching square landscape
//inspired from Flopine 8bit demoscene code
//https://www.youtube.com/watch?v=_JQm46HuDEE
int f=1,t,u,v,x,y;
void setup() {
size(1280, 720);
colorMode(HSB);
noStroke();
clear();
}
void draw() {
t+=f;
if (t>4e3 || t<0) f*=-1;
for (y=0; y< height;y+=5) {
for (x=0; x< width;x+=5) {
u = abs(x-width/2);
v = abs(y-height/2);
fill(((int((u^v)+t)>>2)+.5*t%(u|v))%150+69,255,255);
//fill(((int((u^v)+t)>>2)+.5*t%(u|v))%150+69); //black&white
//fill(((int((u^v)+t)>>2)+.5*t%((u|v)+(u&v)))%150+69,255,255);//reticular diamond overgrow
rect(x,y,5,5);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment