Sketch 2015-05-02
void ofApp::setupAnim() {
ofEnableSmoothing();
ofEnableAntiAliasing();
shapeSystem.setup();
camera.setDistance(120);
for(int i = 0; i < 20; i++) {
GradientShape ring;
rings.push_back(ring);
}
for(int i = 0; i < rings.size(); i++) {
if(i % 3 == 0) color.set(255, 0, 0, 80);
if(i % 3 == 1) color.set(0, 255, 0, 80);
if(i % 3 == 2) color.set(0, 0, 255, 80);
rings.at(i).setupHollowRing(60, 3, i * 3); //Resolution, thickness, diameter
rings.at(i).setColor(color);
rings.at(i).setBlur(3);
shapeSystem.add(rings.at(i));
}
circle.setupFilledRing(30, 30);
circle.setBlur(20);
circle.setColor(ofColor(255, 255, 255, 200));
circle.positionZ(20);
shapeSystem.add(circle);
}
void ofApp::updateAnim(){
for(int i = 0; i < rings.size(); i++) {
if(i % 6 == 0) rings.at(i).rotateX(ofGetFrameNum() * 2);
if(i % 6 == 1) rings.at(i).rotateY(ofGetFrameNum() * 2);
if(i % 6 == 2) rings.at(i).rotateZ(ofGetFrameNum() * 2);
if(i % 6 == 3) rings.at(i).rotateX(-ofGetFrameNum() * 2);
if(i % 6 == 4) rings.at(i).rotateY(-ofGetFrameNum() * 2);
if(i % 6 == 5) rings.at(i).rotateZ(-ofGetFrameNum() * 2);
}
shapeSystem.update();
}
void ofApp::drawAnim() {
ofBackground(0, 0, 0);
camera.begin();
shapeSystem.draw();
camera.end();
if(ofGetFrameNum() == 90) {
renderGif();
}
}
A much more user-freindly shape system