Sketch 2015-08-13
void ofApp::setup(){
ofSetWindowShape(500, 500);
gif.setupPaused(ofGetTimestampString("out/%Y-%m-%d"), 30, 80);
gif.fadeInOut(3, 6, ofColor::white);
gif.enableTextOverlay();
numTissues = 16;
numRoads = 4;
masker.setup(numRoads);
road.setup("tissue.png");
for(int i = 0; i < numRoads; i++) {
scale = ofMap(i, 0, numRoads-1, 4, 2.5);
road.setTextureScale(scale);
road.setTextureOffset(TEXTURE_OFFSET__MIDDLE__LEFT_TO_CENTER);
road.setTextureOffsetY(ofRandom(2));
roads.push_back(road);
tissuesLoader.clear();
scale = ofMap(i, 0, numRoads-1, 64, 1.5);
tissue.setup("glass3.png", scale, i % 2 == 0 ? TEXTURE_OFFSET__MIDDLE__LEFT_TO_CENTER : TEXTURE_OFFSET__MIDDLE__RIGHT_TO_CENTER);
for(int j = 0; j < numTissues; j++) {
tissue.setTextureOffsetY(ofRandom(2));
tissuesLoader.push_back(tissue);
}
tissues.push_back(tissuesLoader);
}
}
void ofApp::update(){
for(int i = 0; i < numRoads; i++) {
masker.beginLayer(i);
{
float others = ofMap(i, 0, numRoads-1, 100, 255);
ofSetColor(ofColor(others, others, others, others));
roads.at(i).incrementTextureOffsetY(ofMap(i, 0, numRoads-1, -0.001, 0.001));
roads.at(i).draw();
}
masker.endLayer(i);
masker.beginMask(i);
{
ofSetColor(ofColor::white);
ofBackground(ofColor::white);
for(int j = 0; j < tissues.size(); j++) {
tissues.at(i).at(j).incrementTextureOffsetY((j+1) * ofMap(i, 0, numRoads-1, 0.0002, -0.0002));
tissues.at(i).at(j).draw();
}
}
masker.endMask(i);
}
}
void ofApp::draw(){
gif.begin();
{
ofBackground(ofColor::white);
masker.draw();
}
gif.endCaptureDraw();
masker.drawOverlay();
}
Writing your own history.