Sketch 2015-05-24
void ofApp::setupAnim() {
ofEnableSmoothing();
for(int i = 0; i < width; i += 10) {
for(int j = 0; j < height; j += 10) {
shape.setupHollowArc(30, 3, 10, 180);
shape.setBlur(1);
shape.setPosition(ofVec3f(i + 5, j + 5, 0));
shape.rotateZ(ofRandom(360));
shapes.push_back(shape);
}
}
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).incrementRotateZ(12) :
shapes.at(i).incrementRotateZ(-12);
}
}
void ofApp::drawAnim() {
ofBackground(0, 0, 0);
ofEnableAlphaBlending();
for(int i = 0; i < shapes.size(); i++) {
shapes.at(i).setColor(ofColor::white);
}
shapeSystem.draw();
rotateScreen(90);
for(int i = 0; i < shapes.size(); i++) {
shapes.at(i).setColor(ofColor(ofColor::black, 192));
}
shapeSystem.draw();
rotateScreen(90);
for(int i = 0; i < shapes.size(); i++) {
shapes.at(i).setColor(ofColor(ofColor::black, 128));
}
shapeSystem.draw();
rotateScreen(90);
for(int i = 0; i < shapes.size(); i++) {
shapes.at(i).setColor(ofColor(ofColor::black, 64));
}
shapeSystem.draw();
ofDisableAlphaBlending();
if(ofGetFrameNum() == 30) renderGif();
}
void ofApp::rotateScreen(float degrees) {
ofTranslate(halfWidth, halfHeight, 0);
ofRotate(degrees);
ofTranslate(-halfWidth, -halfHeight, 0);
}
System.