level 2
Mdew🐷
楼主
第一段
float angle, speed;
float l0, l1, l2, l3;
int n = 6;
boolean first = true;void setup() {
size(800, 800);
smooth();
angle = 0;
speed = 0.01;
background(0);
pixelDensity(displayDensity());
void draw() {
fill(0, 10);
rect(0, 0, width, height); translate(width/2, height/2);
rotate(angle);
l0 = map(mouseX, 0, width, 50, 200);
l1 = map(mouseY, 0, width, 37, 150);
l2 = map(mouseX+mouseY, 0, width+height, 25, 100);
l3 = map(mouseX, 0, height, 25, 100);
for (int i=0; i<n; i++) {
fill(150, 100);
pushMatrix();
rotate(i*TWO_PI/n);
translate(0, l0);
ellipse(0, 0, 12, 12); for (int j=0; j<n; j++) {
fill(#AA1123);
pushMatrix();
rotate(j*TWO_PI/n);
translate(0, l1);
ellipse(0, 0,3, 3); for (int k=0; k<n; k++) {
fill(250, 100);
pushMatrix();
rotate(k*TWO_PI/n);
translate(0, l2);
rect(0, 0, 5, 5);
for (int h=0; h<n; h++) {
fill(#114DAA);
pushMatrix();
rotate(h*TWO_PI/n);
translate(0, l3);
ellipse(0, 0, 2, 2);
popMatrix();
}
popMatrix();
}
popMatrix();
}
popMatrix();
}
angle = (angle+speed)%TWO_PI;
}
2019年01月09日 13点01分
1
float angle, speed;
float l0, l1, l2, l3;
int n = 6;
boolean first = true;void setup() {
size(800, 800);
smooth();
angle = 0;
speed = 0.01;
background(0);
pixelDensity(displayDensity());
void draw() {
fill(0, 10);
rect(0, 0, width, height); translate(width/2, height/2);
rotate(angle);
l0 = map(mouseX, 0, width, 50, 200);
l1 = map(mouseY, 0, width, 37, 150);
l2 = map(mouseX+mouseY, 0, width+height, 25, 100);
l3 = map(mouseX, 0, height, 25, 100);
for (int i=0; i<n; i++) {
fill(150, 100);
pushMatrix();
rotate(i*TWO_PI/n);
translate(0, l0);
ellipse(0, 0, 12, 12); for (int j=0; j<n; j++) {
fill(#AA1123);
pushMatrix();
rotate(j*TWO_PI/n);
translate(0, l1);
ellipse(0, 0,3, 3); for (int k=0; k<n; k++) {
fill(250, 100);
pushMatrix();
rotate(k*TWO_PI/n);
translate(0, l2);
rect(0, 0, 5, 5);
for (int h=0; h<n; h++) {
fill(#114DAA);
pushMatrix();
rotate(h*TWO_PI/n);
translate(0, l3);
ellipse(0, 0, 2, 2);
popMatrix();
}
popMatrix();
}
popMatrix();
}
popMatrix();
}
angle = (angle+speed)%TWO_PI;
}