Sketch 2015-05-01
void ofApp::setupAnim() {
ofEnableSmoothing();
shapeSystem.setup();
camera.setDistance(60);
numShapes = 0;
float offset = 10;
color.set(255, 255, 255, 80);
center.z -= offset;
outerSquare.setup(++numShapes, center, 2, 4, 0, -5, 35, color);
shapeSystem.add(outerSquare);
color.set(255, 255, 255, 80);
center.z -= offset;
innerSquare.setup(++numShapes, center, 2, 4, 0, -5, 20, color);
shapeSystem.add(innerSquare);
center.z -= offset;
color.set(255, 0, 0, 125);
ring1.setup(++numShapes, center, 1, 60, 8, 8, 25, color);
shapeSystem.add(ring1);
center.z -= offset;
color.set(255, 0, 0, 125);
ring2.setup(++numShapes, center, 1, 60, 8, 8, 25, color);
shapeSystem.add(ring2);
center.z -= offset;
color.set(255, 0, 0, 60);
ring3.setup(++numShapes, center, 0, 60, 8, 8, 25, color);
shapeSystem.add(ring3);
center.z -= offset;
color.set(255, 255, 255, 200);
sphere.setup(++numShapes, center, 0, 60, 5, 0, 10, color);
shapeSystem.add(sphere);
}
void ofApp::updateAnim(){
outerSquare.rotateZ(ofMap(-ofGetFrameNum(), 1, 125, 1, 180));
innerSquare.rotateZ(ofMap( ofGetFrameNum(), 1, 125, 1, 180));
ring1.positionZ(sin( ofGetFrameNum() * 2 * 0.05) * 100 - 50);
ring2.positionZ(sin((ofGetFrameNum() * 2 + 20) * 0.05) * 100 - 50);
ring3.positionZ(sin((ofGetFrameNum() * 2 + 40) * 0.05) * 100 - 50);
shapeSystem.update();
}
void ofApp::drawAnim() {
ofBackground(0, 0, 0);
camera.begin();
shapeSystem.draw();
camera.end();
if(ofGetFrameNum() == 125) {
renderGif();
}
}
Adapting code to make transformable alpha-blended geometric shapes