Sketch 2015-04-23
void ofApp::setupAnim() {
increment = 10;
max = 400;
pos = 0;
}
void ofApp::updateAnim(){
pos += increment;
if(pos > max * 2) {
pos = 0;
vertical = !vertical;
}
}
void ofApp::drawAnim() {
ofBackground(0, 0, 0);
for(int i = 1; i <= max; i++) {
if(vertical) drawVerticalLines(i);
else drawHorizontalLines(i);
}
}
void ofApp::drawVerticalLines(int x) {
if(x % 2 == 0) {
ofLine(x, pos - max, x, pos);
} else {
ofLine(x, height - pos, x, max * 2 - pos);
}
}
void ofApp::drawHorizontalLines(int y) {
if(y % 2 == 0) {
ofLine(pos - max, y, pos, y);
} else {
ofLine(height - pos, y, max * 2 - pos, y);
}
}
Something feels beautiful about working with the simplicity of lines.