xxxxxxxxxx
// Left or right mouse to render.
// triangle, pentagon, radial, spiral,
// tessellation, ring, wheel, circle, Mandala, vertex
FiveSides f;
color c0, c1, c2, c3, c4;
color[] palette = {
#000000, #E25272, #EA6CF6, #5C61D4, #66DFF6,
#A1BC8C, #EFE4B0, #FEC285, #000000, #FFFFFF
};
void setup() {
fullScreen();
//size(650, 650);
stroke(255);
strokeWeight(.5);
c0 = c1 = c2 = c3 = c4 = 0;
background(0);
}
void draw() {
translate(width/2, height/2);
drawRing(220);
drawRing(159);
drawRing(115);
drawRing(82);
drawRing(59);
drawRing(42);
drawRing(20);
}
void drawRing(float rad) {
float r = rad/4.24;
for (float a = 0; a < TWO_PI; a += TWO_PI/10) {
pushMatrix();
translate(cos(a) * rad, sin(a) * rad);
rotate(a + TWO_PI/20);
f = new FiveSides(r);
popMatrix();
}
}
class FiveSides {
int n = 0;
float r;
FiveSides(float rin) {
r = rin;
for (float ang = radians (18); ang < TWO_PI; ang += TWO_PI/5) {
pushMatrix();
translate(cos(ang) * r, sin(ang) * r);
rotate(ang);
if (n == 0)fill(c0);
if (n == 1)fill(c1);
if (n == 2)fill(c2);
if (n == 3)fill(c3);
if (n == 4)fill(c4);
drawTri();
popMatrix();
n++;
}
}
void drawTri() {
beginShape();
float theta = -TWO_PI/10;
for (float j = 0; j < 3; j++) {
theta += radians(108);
vertex(cos(theta) * r, sin(theta) * r);
}
endShape(CLOSE);
}
}
void mousePressed() {
if (mouseButton == LEFT){
background(palette[int(random(0, 10))]);
stroke(255);
}
if (mouseButton == RIGHT){
background(0);
stroke(#FAFC6B);
}
c0 = palette[int(random(0, 10))];
c1 = palette[int(random(0, 10))];
c2 = palette[int(random(0, 10))];
c3 = palette[int(random(0, 10))];
c4 = palette[int(random(0, 10))];
}