Sketch 2015-05-26
void ofApp::setupAnim() {
ofEnableSmoothing();
for(int i = -halfWidth; i < halfWidth; i += 120) {
for(int j = -halfHeight; j < halfHeight; j += 120) {
shape.setupHollowSquare(20, 80);
shape.setBlur(1);
shape.setPosition(i + 5, j + 5);
shape.rotateY(ofMap(i, -halfWidth, halfWidth, 0, 90));
shape.rotateX(ofMap(j, -halfHeight, halfHeight, 0, 90));
shapes.push_back(shape);
}
}
shapeSystem.setup();
shapeSystem.setPosition(ofVec3f(halfWidth, halfHeight, 0));
for(int i = 0; i < shapes.size(); i++) {
shapeSystem.add(shapes.at(i));
}
}
void ofApp::updateAnim(){
for(int i = 0; i < shapes.size(); i++) {
i % 2 == 0 ?
shapes.at(i).incrementRotateX(12) :
shapes.at(i).incrementRotateY(-12);
}
shapeSystem.incrementRotateX(2);
shapeSystem.incrementRotateY(2);
shapeSystem.incrementRotateZ(2);
}
void ofApp::drawAnim() {
ofBackground(0, 0, 0);
ofEnableAlphaBlending();
for(int i = -600; i < 600; i+=50) {
for(int j = 0; j < shapes.size(); j++) {
alpha = ofMap(i, -600, 600, 10, 255);
shapes.at(j).positionZ(i);
shapes.at(j).setColor(ofColor(ofColor::white, alpha));
}
shapeSystem.draw();
}
ofDisableAlphaBlending();
if(ofGetFrameNum() == 180) renderGif();
}
Yesterday's squares, evolved (mostly by evolving the addon)