xxxxxxxxxx
float t;
float theta, theta2;
int maxFrameCount = 150;
float numRot = 25;
float numOne = 50;
float numTwo = 150;
int a = 49;
int b = 44;
void setup() {
size(540, 540, P2D);
noFill();
strokeJoin(ROUND);
strokeCap(ROUND);
frameRate(30);
}
void draw() {
background(100,120,120);
translate(width/2, height/2);
t = (float)frameCount/maxFrameCount;
theta = TWO_PI*t;
theta2 = TWO_PI*t*2;
for ( int x= -300; x <= 300; x+= 5) {
float offSet = (x*a);
float offSetRot = (x*b);
float sz1 = map(sin(-theta+offSet), -1, 1, -numOne, numOne);
float sz2 = map(cos(-theta2+offSet), -1, 1, -numTwo, numTwo);
float rotValue = map(sin(-theta+offSetRot), -1, 1, numRot, -numRot);
stroke(255,220,240);
strokeWeight(2);
shapes(x,0, sz1, sz2, rotValue);
}
}
void shapes(float xPos, float yPos, float s1, float s2, float rot) {
pushMatrix();
translate(xPos, yPos);
rotate(TWO_PI*(rot/200));
quad( 0+numOne, 0+numOne, s2, 0, 0-numOne, 0-numOne, 0, s1);
popMatrix();
}