Sketch 2015-09-10
void ofApp::setup(){
ofSetWindowShape(500, 500);
gif.setup(50);
gif.fadeInOut(2, 3, ofColor::darkGray);
gif.enableTextOverlay();
numLayers = 4;
numRects = gif.width * 0.5;
masker.setup(numLayers);
img.setup("road.png", 1.0, TEXTURE_OFFSET__MIDDLE__RIGHT_TO_CENTER);
for(int i = 0; i < numLayers; i++) {
scale = ofMap(i, 0, numLayers-1, -3, 16);
img.setTextureScale(scale);
img.setTextureOffsetY(ofRandom(2));
textures.push_back(img);
}
img.setup("pcb2.png", 1.0, TEXTURE_OFFSET__MIDDLE__LEFT_TO_CENTER);
for(int i = 0; i < numLayers; i++) {
scale = ofMap(i, 0, numLayers-1, 2, 1);
img.setTextureScale(scale);
img.setTextureOffsetY(ofRandom(2));
masks.push_back(img);
}
for(int i = 0; i < numRects; i++) {
rectAlphaMultipliers.push_back(ofRandom(0.1, 0.5));
}
rectWidth = gif.width / numRects;
ofSetWindowShape(1200, 1200);
masker.toggleOverlay();
}
void ofApp::update(){
for(int i = 0; i < numLayers; i++) {
masker.beginLayer(i);
{
textures.at(i).incrementTextureOffsetY(ofMap(i, 0, numLayers-1, -0.002, 0.002));
textures.at(i).draw();
}
masker.endLayer(i);
masker.beginMask(i);
{
masks.at(i).incrementTextureOffsetY(ofMap(i, 0, numLayers-1, -0.002, 0.002));
masks.at(i).draw();
}
masker.endMask(i);
}
}
void ofApp::draw(){
gif.begin();
{
masker.draw();
}
gif.endCaptureDraw();
masker.drawOverlay();
}
Faces in the soup