SketchPad

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

Sketch 2015-06-09

        void ofApp::setupAnim() {
    fontSize = 64;
    loadFonts();
    quarterHeight = halfHeight * 0.5;
}

void ofApp::updateAnim(){
    if(ofGetFrameNum() % 3 == 0) {
        random_shuffle(fonts.begin(), fonts.end());
    }
}

void ofApp::drawAnim() {
    ofBackground(ofColor::black);
    ofSetColor(ofColor::white);

    ofSetRectMode(OF_RECTMODE_CENTER);
    fonts.at(0).drawStringCentered("GOOD", halfWidth, quarterHeight);
    fonts.at(1).drawStringCentered("BEHAVIOUR", halfWidth, halfHeight + quarterHeight);
    ofSetRectMode(OF_RECTMODE_CORNER);

    if(ofGetFrameNum() == 60) {
        renderGif();
    }
}
    

...good behaviour

Daily sketch

Sketch 2015-06-08

        void ofApp::setupAnim() {
    shapeSystem.setup();
    shape1.setupGradientSquare(halfWidth*0.15, halfWidth*0.85);
    shape2.setupGradientSquare(halfWidth*0.15, halfWidth*0.85);
    shape3.setupGradientSquare(halfWidth*0.15, halfWidth*0.85);
    shape4.setupGradientSquare(halfWidth*0.15, halfWidth*0.85);

    shape1.setPosition(halfWidth*0.5, halfHeight*0.5);
    shapeSystem.add(shape1);
    
    shape2.setPosition(halfWidth*0.5+halfWidth, halfHeight*0.5);
    shapeSystem.add(shape2);
    
    shape3.setPosition(halfWidth*0.5, halfHeight*0.5+halfHeight);
    shapeSystem.add(shape3);
    
    shape4.setPosition(halfWidth*0.5+halfHeight, halfHeight*0.5+halfHeight);
    shapeSystem.add(shape4);
    
    masker.setup(width, height);
    layerId = masker.newLayer();
    
    ofDisableArbTex();
    offset = ofRandom(3);
    setupImage("foil.png", &img, &tex);

    plane.set(width, height);
    plane.setPosition(halfWidth, halfHeight, 0);
    plane.setResolution(2, 2);
}

void ofApp::setupImage(string file, ofImage *img, ofTexture *tex) {
    img->loadImage(file);
    *tex = img->getTextureReference();
    tex->setTextureWrap(GL_MIRRORED_REPEAT, GL_MIRRORED_REPEAT);
}

void ofApp::drawLayer(ofTexture *tex) {
    plane.mapTexCoords(tx0, ty0, tx1, ty1);
    plane.mapTexCoords(tx1, ty1, tx0, ty0);
    tex->bind();
    plane.draw();
    tex->unbind();
}

void ofApp::updateAnim(){
    masker.beginLayer(layerId);
    if(ofRandom(1) > 0.4) ofBackground(ofColor::black);
    ofSetColor(ofColor::red);
    tx0 = -ofGetFrameNum() * 0.00006 + offset + ofRandom(-0.09, 0.09);
    ty0 = ofGetFrameNum() * 0.005;
    tx1 = tx0 - 1;
    ty1 = ty0 - 0.25;
    drawLayer(&tex);
    masker.endLayer(layerId);
    
    masker.beginMask(layerId);
    ofBackground(ofColor::black);
    if(ofGetFrameNum() == 0 || ofRandom(1) > 0.2) {
        ofSetColor(ofColor::white, 32);
        for(int i = 0; i < 30; i++) {
            ofTriangle(ofRandom(-width, width*2), ofRandom(-height, height*2),
                       ofRandom(-width, width*2), ofRandom(-height, height*2),
                       ofRandom(-width, width*2), ofRandom(-height, height*2));
        }
    } else if(ofRandom(1) > 0.15) {
        offset = ofRandom(3);
    }
    masker.endMask(layerId);
}

void ofApp::drawAnim() {
    if(ofRandom(1) > 0.4) ofBackground(ofColor::black);
    ofSetColor(ofColor::white);

    tx0 = ofGetFrameNum() * 0.00006 + offset;
    tx1 = tx0 - 1;
    
    ofTranslate(-halfWidth, -halfHeight, 0);
    drawLayer(&tex);
    masker.draw();
    
    ofTranslate(width, 0, 0);
    drawLayer(&tex);
    masker.draw();
    
    ofTranslate(0, height, 0);
    drawLayer(&tex);
    masker.draw();
    
    ofTranslate(-width, 0, 0);
    drawLayer(&tex);
    masker.draw();
    
    ofTranslate(halfWidth, -halfHeight, 0);
    shapeSystem.draw();
    
    if(ofGetFrameNum() == 72) {
        renderGif();
    }
}
    

A continued exploration of texture

Daily sketch

Sketch 2015-06-07

        void ofApp::setupAnim() {
    size = 60;
    margin = width - size;
    halfMargin = margin * 0.5;
}

void ofApp::drawAnim() {
    ofBackground(ofColor::white);
    
    ofSetColor(ofColor::black, 10);
    for(int i = 0; i < 1400; i++) {
        x = width * 0.5 - size * 0.5 + (ofRandom(margin) - halfMargin);
        y = floor(ofRandom(height/size)) * size;
        ofRect(x, y, size, size);
    }
    
    ofSetColor(ofColor::white, 64);
    for(int i = 0; i < height/size; i++) {
        ofRect(halfMargin, i * size + size * 0.5, width - margin, 4);
    }
    
    ofSetColor(ofColor::white, 64);
    for(int i = -height; i < height; i++) {
        ofRect(halfMargin, (i * size * 0.5) + ofGetFrameNum(), width - margin, 4);
        ofRect(halfMargin, (i * size * 0.5) - ofGetFrameNum(), width - margin, 4);
    }
    
    if(ofGetFrameNum() == 30) {
        renderGif();
    }
}
    

Running out of time.

Daily sketch

Sketch 2015-06-06

        void ofApp::setupAnim() {
    ofDisableArbTex();
    setupImage("surface.png", &img, &tex);

    plane.setResolution(2, 2);
    
    offset.set(1, 0.04);
}

void ofApp::setupImage(string file, ofImage *img, ofTexture *tex) {
    img->loadImage(file);
    *tex = img->getTextureReference();
    tex->setTextureWrap(GL_MIRRORED_REPEAT, GL_MIRRORED_REPEAT);
}

void ofApp::drawLayer(ofTexture *tex) {
    tx0 = offset.x;
    ty0 = offset.y;
    tx1 = tx0 - 0.66666668;
    ty1 = ty0 - 1;
    plane.setPosition(halfWidth, halfHeight, 0);
    plane.set(width, height);
    plane.mapTexCoords(tx0, ty0, tx1, ty1);
    plane.mapTexCoords(tx1, ty1, tx0, ty0);
    tex->bind();
    plane.draw();
    tex->unbind();
}

void ofApp::drawLayer2(ofTexture *tex) {
    tx0 = offset.x - (0.66666668 * 0.5);
    ty0 = offset.y -0.5;
    tx1 = tx0 - (0.66666668 * 0.5);
    ty1 = ty0 - 0.5;
    plane.setPosition(halfWidth*0.5, halfHeight*0.5, 0);
    plane.set(halfWidth, halfHeight);
    plane.mapTexCoords(tx0, ty0, tx1, ty1);
    plane.mapTexCoords(tx1, ty1, tx0, ty0);
    tex->bind();
    plane.draw();
    tex->unbind();
}

void ofApp::rotateScreen(float degrees, int amount) {
    ofTranslate(amount, amount, 0);
    ofRotate(degrees);
    ofTranslate(-amount, -amount, 0);
}

void ofApp::updateAnim(){
    offset.x += 0.02;
}

void ofApp::drawAnim() {
    ofBackground(ofColor::black);
    ofSetColor(ofColor::wheat);
    
    
    offset.y = 0.02;
    drawLayer(&tex);
    rotateScreen(90, halfWidth);
    drawLayer(&tex);
    rotateScreen(90, halfHeight);
    drawLayer(&tex);
    rotateScreen(90, halfWidth);
    drawLayer(&tex);
    rotateScreen(90, halfHeight);
    drawLayer2(&tex); //cover up

    if(ofGetFrameNum() == 100) {
        renderGif();
    }
}
    

Folded like the top of a cardbaord box

Daily sketch

Sketch 2015-06-05

        void ofApp::setupAnim() {
    masker.setup(width, height);
    layerId = masker.newLayer();
    
    ofDisableArbTex();
    offset.x = ofRandom(30);
    offset.y = ofRandom(30);
    movingLeft = true;
    setupImage("surface.png", &img, &tex);

    plane.set(width, height);
    plane.setPosition(halfWidth, halfHeight, 0);
    plane.setResolution(2, 2);
}

void ofApp::setupImage(string file, ofImage *img, ofTexture *tex) {
    img->loadImage(file);
    *tex = img->getTextureReference();
    tex->setTextureWrap(GL_MIRRORED_REPEAT, GL_MIRRORED_REPEAT);
}

void ofApp::drawLayer(ofTexture *tex) {
    plane.mapTexCoords(tx0, ty0, tx1, ty1);
    plane.mapTexCoords(tx1, ty1, tx0, ty0);
    tex->bind();
    plane.draw();
    tex->unbind();
}

void ofApp::updateAnim(){
    masker.beginLayer(layerId);
    ofBackground(ofColor::black);
    ofSetColor(ofColor::red);
    tx0 = offset.x + (movingLeft ? ofGetFrameNum() : -ofGetFrameNum()) * 0.0005;
    ty0 = offset.y;
    tx1 = tx0 - 0.16666667;
    ty1 = ty0 - 1;
    drawLayer(&tex);
    masker.endLayer(layerId);
    
    masker.beginMask(layerId);
    ofBackground(ofColor::black);
    for(int i = 0; i < 8; i++) {
        ofSetColor(ofColor::white, ofRandom(32));
        ofRotateZ(ofRandom(360));
        ofRect(-width*2, ofRandom(height), width*4, ofRandom(halfHeight, height));
    }
    masker.endMask(layerId);

    if(ofRandom(1) > 0.5) {
        offset.x = ofRandom(30);
        offset.y = ofRandom(30);
        movingLeft = !movingLeft;
    }
}

void ofApp::drawAnim() {
    if(ofGetFrameNum() == 0) ofBackground(ofColor::black);
    ofSetColor(ofColor::white, 40);
    drawLayer(&tex);
    masker.draw();
    if(ofGetFrameNum() == 72) {
        renderGif();
    }
}
    

It's dark and murky

Daily sketch

Sketch 2015-06-04

        
//Pattern based on http://www.openprocessing.org/sketch/157035

ofxLayerMask masker;
int layerId;

float tx0, ty0, tx1, ty1;
float offset;
ofImage img;
ofTexture tex;
ofPlanePrimitive plane;

float x, y, radians;

void ofApp::setupAnim() {
    masker.setup(width, height);
    layerId = masker.newLayer();
    
    ofDisableArbTex();
    offset = ofRandom(3);
    setupImage("face.png", &img, &tex);

    plane.set(width, height);
    plane.setPosition(halfWidth, halfHeight, 0);
    plane.setResolution(2, 2);
}

void ofApp::setupImage(string file, ofImage *img, ofTexture *tex) {
    img->loadImage(file);
    *tex = img->getTextureReference();
    tex->setTextureWrap(GL_MIRRORED_REPEAT, GL_MIRRORED_REPEAT);
}

void ofApp::drawLayer(ofTexture *tex) {
    plane.mapTexCoords(tx0, ty0, tx1, ty1);
    plane.mapTexCoords(tx1, ty1, tx0, ty0);
    tex->bind();
    plane.draw();
    tex->unbind();
}

void ofApp::updateAnim(){
    masker.beginLayer(layerId);
    ofBackground(ofColor::black);
    ofSetColor(ofColor::white);
    tx0 = 1;
    ty0 = ofGetFrameNum() * 0.0012 + offset;
    tx1 = tx0 - 1;
    ty1 = ty0 - 0.2;
    drawLayer(&tex);
    masker.endLayer(layerId);
    
    masker.beginMask(layerId);
    ofBackground(ofColor::black);
    if(ofGetFrameNum() == 0 || ofRandom(1) > 0.6) {
        ofTriangle(ofRandom(-width, width*2), ofRandom(-height, height*2),
                   ofRandom(-width, width*2), ofRandom(-height, height*2),
                   ofRandom(-width, width*2), ofRandom(-height, height*2));
    } else if(ofRandom(1) > 0.3) {
        offset = ofRandom(3);
    }
    masker.endMask(layerId);
}

void ofApp::drawAnim() {
    if(ofGetFrameNum() == 0) ofBackground(ofColor::black);
    ofSetColor(ofColor::white, 40);
    drawLayer(&tex);

    ofSetColor(ofColor::white, 15);
    ofTranslate(halfWidth, halfHeight);
    for (int i = 0; i < 360; i+=6) {
        for (int q = 0; q < 360; q+=360) {
            radians = ofDegToRad(q + i + ofGetFrameNum() * 5);
            
            x = ofMap(sin(radians) * i, -600, -10, i, 0);
            y = ofMap(cos(radians) * i, -600, -10, 0, i);
            ofCircle(x, y, 2);
            ofCircle(y, x, 2);
            ofCircle(-x, -y, 2);
            ofCircle(-y, -x, 2);
            
            x = ofMap(sin(radians) * i, -600, -10, -i, 0);
            ofCircle(x, y, 2);
            ofCircle(y, x, 2);
            ofCircle(-x, -y, 2);
            ofCircle(-y, -x, 2);
        }
    }
    ofTranslate(-halfWidth, -halfHeight);
    masker.draw();
    if(ofGetFrameNum() == 72) {
        renderGif();
    }
}
    

Frustration can be bitter sweet

Daily sketch

Sketch 2015-06-03

        void ofApp::setup(){
    playing = true;
    note = 60;

    manager.setup();
    manager.toggleDebugUI();
    manager.add(&chain1, "tal-1", ofColor::blue);
    manager.add(&chain2, "tal-2", ofColor::red);

    bpm.setBpm(160);
    ofAddListener(bpm.beatEvent, this, &ofApp::play);
    bpm.start();
}

void ofApp::play(void){
    if(playing) {
        chain1.midi()->sendNoteOn(1, note);
        chain2.midi()->sendNoteOn(1, note);
    }
}

void ofApp::togglePlaying() {
    playing = !playing;
    if(!playing) {
        chain1.midi()->sendNoteOff(1, note);
        chain2.midi()->sendNoteOff(1, note);
    }
}

void ofApp::update(){
    manager.update();
    
    val = ofMap(sin(ofGetFrameNum() * 0.04), -1, 1, 30, 59);
    chain1.getReverb()->set(kReverbParam_DryWetMix, val);
}
    

Crisp vs noisy