Sketch 2015-06-17
void ofApp::setupAnim() {
numImages = 8;
highestIndex = numImages - 1;
image.setup("surface.png");
for(int i = 0; i < numImages; i++) {
image.setTextureOffsetX(ofRandom(500));
image.setTextureScale(ofMap(i, 0, highestIndex, 2, 0.35));
image.setPlaneHeight(ofMap(i, 0, highestIndex, 500, 200));
image.setPlanePosition(0, ofMap(i, 0, highestIndex, -50, 300));
images.push_back(image);
imgColors.push_back(ofColor(ofMap(i, 0, highestIndex, 100, 255), ofMap(i, 0, highestIndex, 100, 0), 0, ofMap(i, 0, highestIndex, 0, 255)));
}
system.setup();
shape.setupGradientSquare(70, height * 2);
shape.positionX(-halfWidth - 35);
shape.positionY(40);
shape.setColor(ofColor(ofColor::white, 96));
system.add(shape);
}
void ofApp::updateAnim(){
for(int i = 0; i < numImages; i++) {
images.at(i).incrementTextureOffsetX(i % 2 == 0 ? 0.03 : -0.03);
}
}
void ofApp::drawAnim() {
ofBackground(ofColor::black);
ofEnableAlphaBlending();
for(int i = 0; i < numImages; i++) {
ofSetColor(imgColors.at(i));
rotateScreen(90);
images.at(i).draw();
rotateScreen(180);
images.at(i).draw();
rotateScreen(90);
}
rotateScreen(180);
system.draw();
rotateScreen(180);
system.draw();
ofDisableAlphaBlending();
if(ofGetFrameNum() == 67) {
renderGif();
}
}
void ofApp::rotateScreen(float degrees) {
ofTranslate(halfWidth, halfHeight);
ofRotateZ(degrees);
ofTranslate(-halfWidth, -halfHeight);
}
Vanishing point