Sketch 2015-05-09
void ofApp::setupBackground(){
for(int i = 0; i < 3; i++) {
ofxShape shape;
shape.setupFilledSquare(ofRandom(3, 28));
shape.scaleX(ofRandom(3, 28));
shape.scaleY(ofRandom(3, 28));
shape.positionX(ofRandom(-28, width + 28));
shape.positionY(ofRandom(-28, height + 28));
shape.setBlur(1);
shape.setOpacity(58);
backgroundShapes.push_back(shape);
}
push(&backgroundShapes, &backgroundSystems);
}
void ofApp::setupMask(){
for(int i = 0; i < 500; i++) {
float x = ofRandom(-ringSize, width + ringSize);
float y = ofRandom(-ringSize, height + ringSize);
float z = ofRandom(-100, 100);
ofxShape shape;
shape.setupGradientRing(60, -4.6, ringSize);
shape.setPosition(ofVec3f(x, y, z));
shape.setBlur(ringSize * 0.5);
shape.setOpacity(ofRandom(60, 200));
maskShapes.push_back(shape);
shape.setDiameter(ringSize * 0.5);
shape.setThickness(4.6);
maskShapes.push_back(shape);
}
push(&maskShapes, &maskSystems);
}
void ofApp::setupForeground(){
//Background color
ofxShape shape;
shape.setupFilledSquare(width);
shape.setColor(ofColor::red);
shape.positionX(width * 0.5);
shape.positionY(height * 0.5);
foregroundShapes.push_back(shape);
//Lines
for(int i = 0; i < height; i += lineDistance) {
ofxShape shape;
shape.setupFilledSquare(lineThickness);
shape.scaleX(height);
shape.setColor(ofColor::blue);
shape.positionY(i);
shape.setBlur(lineThickness);
foregroundShapes.push_back(shape);
}
//Color filter
shape.setupFilledSquare(width);
shape.rotateZ(-38);
shape.scaleY(3);
shape.positionX(-250);
shape.setColor(ofColor::purple);
shape.setBlur(270);
shape.setOpacity(220);
foregroundShapes.push_back(shape);
shape.positionX(500);
foregroundShapes.push_back(shape);
push(&foregroundShapes, &foregroundSystems);
}
void ofApp::updateAnim(){
for(int i = 0; i < maskShapes.size(); i += 2) {
float y = 5 + maskShapes.at(i).getPosition().y;
if(y > height) {
y -= height;
}
maskShapes.at(i ).positionY(y);
maskShapes.at(i + 1).positionY(y);
}
for(int i = 1; i < foregroundShapes.size() - 2; i++) {
float y = foregroundShapes.at(i).getPosition().y - (lineDistance * 0.04);
if(y < -lineThickness) y = height;
foregroundShapes.at(i).positionY(y);
}
}
Three systems overlaid: background gray boxes, rings in the mask layer, horizontal lines in the foreground