Check the actual processing sketch here :
https://www.openprocessing.org/sketch/562216
The Actual Code :
int num = 100, num2 = 30;
int frms = 50;
float beta;
void setup() {
size(1000, 600, P2D);
smooth(8);
}
void draw() {
stroke(34,150);
noFill();
strokeCap(ROUND);
translate(width/4, height/4);
strokeWeight(1);
for (int j=0; j<num2; j++) {
float offSet = PI/num2*j;
beginShape();
for (int i=0; i<num; i++) {
float angle = TWO_PI/num*i;
float a = map(sin(beta-angle*2+offSet), -1, 1, mouseX, 5);
float b = map(sin(beta), -1, 1, 3, 7);
float r = mouseY*(a + b*cos(angle));
float x = cos(angle)*mouseX;
float y = sin(angle)*r;
vertex(x, y);
}
endShape(CLOSE);
}
stroke(#FFE705);
noFill();
strokeCap(SQUARE);
translate(width/2, height/2);
for (int j=0; j<num2; j++) {
float offSet = PI/num2*j;
beginShape();
for (int i=0; i<num; i++) {
float angle = TWO_PI/num*i;
float a = map(sin(beta-angle*2+offSet),1, mouseX, 10,mouseY);
float b = map(sin(beta), -10, 5, 5, 10);
float r = 25*(a + b*cos(angle));
float x = cos(angle)*r;
float y = sin(angle)*r;
vertex(x, y);
}
endShape(CLOSE);
}
beta += TWO_PI/frms;
}
0 comments:
Post a Comment