SketchPad

Some web space to sketch, doodle and make notes. Made using these tools. See more of my work here.

Daily Sketches

Sketch 2015-04-27

        void ofApp::setupAnim() {
    ofDisableArbTex();
    
    img.loadImage("tissue.png");
    texture = img.getTextureReference();
    texture.setTextureWrap(GL_MIRRORED_REPEAT, GL_MIRRORED_REPEAT);
    
    offset = ofRandom(1);
    shift = false;
    numShifts = 0;
    
    //Position the planes to take up the full screen
    for(int i = 0; i < 2; i++) {
        planes.push_back(plane);
        planes.at(i).set(ofGetHeight(), ofGetWidth());
        planes.at(i).setPosition(ofGetWidth() * 0.5, ofGetHeight() * 0.5, 0);
        planes.at(i).setResolution(2, 2);
    }
}

void ofApp::updateAnim(){
    if(!shift && ofRandom(1) < 0.15) {
        numShifts++;
        shift = true;
        offset = getNewOffset();
    }
    
    tx0 = 0 * offset * 0.1;
    ty0 = offset + ofGetFrameNum() * 0.001;
    tx1 = tx0 + 1;
    ty1 = ty0 + 2;
    
    //Position the texture on the plane
    planes.at(0).mapTexCoords(tx0, ty0, tx1, ty1);
    planes.at(1).mapTexCoords(tx1, ty1, tx0, ty0);
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);
    
    if(shift) {
        if(ofRandom(1) > 0.2) shift = false;
    } else {
        texture.bind();
        for(int i = 0; i < planes.size(); i++) {
            planes.at(i).draw();
        }
        texture.unbind();
    }
}

float ofApp::getNewOffset() {
    do {
        candidateOffset = ofRandom(1);
    } while(abs(candidateOffset - offset) < 0.2);
    
    return candidateOffset;
}
    

Overlaid media with alpha transparency, glimmering when squished into 400 pixels and slowly translated.

Daily sketch