SketchPad

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

Sketch 2015-05-26

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    
    for(int i = -halfWidth; i < halfWidth; i += 120) {
        for(int j = -halfHeight; j < halfHeight; j += 120) {
            shape.setupHollowSquare(20, 80);
            shape.setBlur(1);
            shape.setPosition(i + 5, j + 5);
            shape.rotateY(ofMap(i, -halfWidth, halfWidth, 0, 90));
            shape.rotateX(ofMap(j, -halfHeight, halfHeight, 0, 90));
            shapes.push_back(shape);
        }
    }
    
    shapeSystem.setup();
    shapeSystem.setPosition(ofVec3f(halfWidth, halfHeight, 0));
    for(int i = 0; i < shapes.size(); i++) {
        shapeSystem.add(shapes.at(i));
    }
}

void ofApp::updateAnim(){
    for(int i = 0; i < shapes.size(); i++) {
        i % 2 == 0 ?
            shapes.at(i).incrementRotateX(12) :
            shapes.at(i).incrementRotateY(-12);
    }
    
    shapeSystem.incrementRotateX(2);
    shapeSystem.incrementRotateY(2);
    shapeSystem.incrementRotateZ(2);
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);

    ofEnableAlphaBlending();
    
    for(int i = -600; i < 600; i+=50) {
        for(int j = 0; j < shapes.size(); j++) {
            alpha = ofMap(i, -600, 600, 10, 255);
            shapes.at(j).positionZ(i);
            shapes.at(j).setColor(ofColor(ofColor::white, alpha));
        }
        shapeSystem.draw();
    }

    ofDisableAlphaBlending();

    if(ofGetFrameNum() == 180) renderGif();
}
    

Yesterday's squares, evolved (mostly by evolving the addon)

Daily sketch

Sketch 2015-05-25

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    
    for(int i = 0; i < width; i += 120) {
        for(int j = 0; j < height; j += 120) {
            shape.setupHollowSquare(20, 80);
            shape.setBlur(1);
            shape.setPosition(ofVec3f(i + 5, j + 5, 0));
            shape.rotateZ(ofRandom(360));
            shapes.push_back(shape);
        }
    }
    
    for(int i = 0; i < shapes.size(); i++) {
        shapeSystem.add(shapes.at(i));
    }
}

void ofApp::updateAnim(){
    for(int i = 0; i < shapes.size(); i++) {
        i % 2 == 0 ?
            shapes.at(i).incrementRotateZ(12) :
            shapes.at(i).incrementRotateZ(-12);
    }
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);

    ofEnableAlphaBlending();

    ofTranslate(-30, -30);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::white, 64));
    }
    shapeSystem.draw();

    ofTranslate(10, 10);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::white, 128));
    }
    shapeSystem.draw();

    ofTranslate(10, 10);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::white, 192));
    }
    shapeSystem.draw();

    ofTranslate(10, 10);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::white, 255));
    }
    shapeSystem.draw();

    ofDisableAlphaBlending();

    if(ofGetFrameNum() == 30) renderGif();
}
    

Fast sketches are meaningless.

Daily sketch

Sketch 2015-05-24

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    
    for(int i = 0; i < width; i += 10) {
        for(int j = 0; j < height; j += 10) {
            shape.setupHollowArc(30, 3, 10, 180);
            shape.setBlur(1);
            shape.setPosition(ofVec3f(i + 5, j + 5, 0));
            shape.rotateZ(ofRandom(360));
            shapes.push_back(shape);
        }
    }
    
    for(int i = 0; i < shapes.size(); i++) {
        shapeSystem.add(shapes.at(i));
    }
}

void ofApp::updateAnim(){
    for(int i = 0; i < shapes.size(); i++) {
        i % 2 == 0 ?
            shapes.at(i).incrementRotateZ(12) :
            shapes.at(i).incrementRotateZ(-12);
    }
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);
    
    ofEnableAlphaBlending();
    
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor::white);
    }
    shapeSystem.draw();
    
    rotateScreen(90);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::black, 192));
    }
    shapeSystem.draw();
    
    rotateScreen(90);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::black, 128));
    }
    shapeSystem.draw();
    
    rotateScreen(90);
    for(int i = 0; i < shapes.size(); i++) {
        shapes.at(i).setColor(ofColor(ofColor::black, 64));
    }
    shapeSystem.draw();
    
    ofDisableAlphaBlending();
    
    if(ofGetFrameNum() == 30) renderGif();
}

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

System.

Daily sketch

Sketch 2015-05-23

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    masker.setup(width, height);
    shapeSystem.setup();
    
    shape.setupGradientRing(8, 20, 160);
    shape.setPosition(ofVec3f(halfWidth, halfHeight, 0));
    for(int i = -10000; i < 1000; i+=12) {
        shape.positionZ(i);
        shapes.push_back(shape);
    }
    
    for(int i = 0; i < shapes.size(); i++) {
        shapeSystem.add(shapes.at(i));
    }
    
    img1.loadImage("welcome.png");
    img2.loadImage("unwelcome.png");
    flip = false;
}

void ofApp::updateAnim(){
    for(int i = 0; i < shapes.size(); i++) {
        increment = (i % 2 == 0) ? 4 : -8;
        shapes.at(i).incrementRotateX(increment);
        shapes.at(i).incrementRotateY(increment);
        shapes.at(i).incrementRotateZ(increment / 4);
    }
    
    masker.beginMask();
    ofBackground(ofColor::black);
    shapeSystem.draw();
    if(ofRandom(1) <= 0.1) {
        ofSetColor(ofColor::white, 255);
        ofRect(0, 0, width, height);
        flip = !flip;
    }
    masker.endMask();
    
    masker.beginBackground();
    flip ? img2.draw(0, 0) : img1.draw(0, 0);
    masker.endBackground();
    
    masker.beginForeground();
    flip ? img1.draw(0, 0) : img2.draw(0, 0);
    masker.endForeground();
}

void ofApp::drawAnim() {
    masker.draw();
    if(ofGetFrameNum() == 90) renderGif();
}
    

Sterility and warmth on the last day in Miami

Daily sketch

Sketch 2015-05-22

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    ofSetLineWidth(4);
    masker.setup(width, height);
    paused = true;
    
    img1.loadImage("chihuly-1.png");
    img2.loadImage("chihuly-2.png");
    numBoxSets = 200;
}

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

void ofApp::updateAnim(){
    ofEnableAlphaBlending();
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    
    masker.beginBackground();
    img1.draw(0, 0);
    ofSetColor(ofColor(ofColor::black, 40));
    ofRect(0, 0, width, height);
    masker.endBackground();
    
    masker.beginMask();
    ofBackground(ofColor::black);
    for(int i = 0; i < numBoxSets; i++) {
        for(int j = 0; j < width; j+=20) {
            ofSetColor(ofColor::white, ofRandom(10, 35));
            
            ofRect(
                   ofRandom(j - 10, j + 10),
                   ofMap(i, 0, numBoxSets, width * 0.5, width),
                   ofRandom(2, 20),
                   ofRandom(20, 50));
        }
        rotateScreen(10);
    }
    masker.endMask();
    
    masker.beginForeground();
    img2.draw(0, 0);
    ofSetColor(ofColor(ofColor::black, 40));
    ofRect(0, 0, width, height);
    masker.endForeground();
    
    ofDisableBlendMode();
    ofDisableAlphaBlending();
}

void ofApp::drawAnim() {
    masker.draw();
    ofEnableAlphaBlending();
    for(int i = 0; i < numBoxSets; i++) {
        for(int j = 0; j < width; j+=20) {
            if(j % 40 == 0) ofSetColor(ofColor::white, ofRandom(1, 7));
            else ofSetColor(ofColor::black, ofRandom(1, 7));
            
            ofRect(
                ofRandom(j - 10, j + 10),
                ofMap(i, 0, numBoxSets, 30, -30),
                ofRandom(2, 20),
                ofRandom(20, 50));
        }
        rotateScreen(10);
    }
    ofDisableAlphaBlending();
    
    if(ofGetFrameNum() == 50) paused = false;
    if(ofGetFrameNum() == 80) renderGif();
}
    

Vacation Day 3 - Dale Chihuly at Fairchild Botanical Garden

Daily sketch

Sketch 2015-05-21

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    ofSetLineWidth(4);
    masker.setup(width, height);
    
    img1.loadImage("boat-ride.png");
    img2.loadImage("maersk.png");
    
    for(int i = 0; i < 10; i++) {
        ofxAnimatableFloat animHeight;
        animHeight.reset(ofRandom(90));
        heights.push_back(animHeight);
        
        ofxAnimatableFloat opacity;
        opacity.reset(ofMap(i, 0, 300, 120, 255));
        opacities.push_back(opacity);
        
        ofxAnimatableFloat target;
        target.reset(ceil(ofRandom(-height, height * 2)));
        targets.push_back(target);
        
        ofxAnimatableFloat position;
        position.reset(createDistinct(target.val()));
        position.setCurve(SWIFT_GOOGLE);
        position.setRepeatType(LOOP_BACK_AND_FORTH);
        position.setDuration(ceil(ofRandom(4)) * 0.5);
        position.animateTo(targets.at(i).val());
        positions.push_back(position);
    }
}

float ofApp::createDistinct(float from) {
    float candidate;
    do candidate = ceil(ofRandom(-height, height * 2));
    while(abs(candidate - from) < 150);
    return candidate;
}

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

void ofApp::updateAnim(){
    ofEnableAlphaBlending();
    
    masker.beginBackground();
    img1.draw(0, 0);
    ofSetColor(ofColor(ofColor::black, 40));
    ofRect(0, 0, width, height);
    masker.endBackground();
    
    masker.beginMask();
    ofBackground(ofColor::black);
    for(int i = 0; i < 4; i++) {
        rotateScreen(90);
        for(int i = 0; i < positions.size(); i++) {
            positions.at(i).update(0.05);
            ofSetColor(ofColor::white, opacities.at(i).val());
            ofRect(0, positions.at(i).val(), width, heights.at(i).val());
        }
    }
    masker.endMask();
    
    masker.beginForeground();
    img2.draw(0, 0);
    ofSetColor(ofColor(ofColor::black, 40));
    ofRect(0, 0, width, height);
    masker.endForeground();
    
    ofDisableAlphaBlending();
}

void ofApp::drawAnim() {
    masker.draw();
    bool allFinished = true;
    for(int i = 0; i < positions.size(); i++) {
        if(positions.at(i).getPlayCount() < 1) {
            allFinished = false;
        }
    }
    if(allFinished) renderGif();
}
    

Vacation Day 2

Daily sketch

Sketch 2015-05-20

        void ofApp::setupAnim() {
    ofEnableSmoothing();
    ofSetLineWidth(4);
    masker.setup(width, height);
    
    img1.loadImage("whole-foods.png");
    img2.loadImage("excess.png");
    
    for(int i = 0; i < 40; i++) {
        ofxAnimatableFloat animHeight;
        animHeight.reset(ofRandom(90));
        heights.push_back(animHeight);
        
        ofxAnimatableFloat opacity;
        opacity.reset(ofMap(i, 0, 300, 120, 255));
        opacities.push_back(opacity);
        
        ofxAnimatableFloat target;
        target.reset(ceil(ofRandom(-height, height * 2)));
        targets.push_back(target);
        
        ofxAnimatableFloat position;
        position.reset(createDistinct(target.val()));
        position.setCurve(SWIFT_GOOGLE);
        position.setRepeatType(LOOP_BACK_AND_FORTH);
        position.setDuration(ceil(ofRandom(4)) * 0.5);
        position.animateTo(targets.at(i).val());
        positions.push_back(position);
    }
}

float ofApp::createDistinct(float from) {
    float candidate;
    do candidate = ceil(ofRandom(-height, height * 2));
    while(abs(candidate - from) < 150);
    return candidate;
}

void ofApp::updateAnim(){
    ofEnableAlphaBlending();
    
    masker.beginBackground();
    img1.draw(0, 0);
    ofSetColor(ofColor(ofColor::black, 40));
    ofRect(0, 0, width, height);
    masker.endBackground();
    
    masker.beginMask();
    ofBackground(ofColor::black);
    for(int i = 0; i < positions.size(); i++) {
        positions.at(i).update(0.05);
        ofSetColor(ofColor::white, opacities.at(i).val());
        ofRect(0, positions.at(i).val(), width, heights.at(i).val());
    }
    masker.endMask();
    
    masker.beginForeground();
    img2.draw(0, 0);
    ofSetColor(ofColor(ofColor::black, 40));
    ofRect(0, 0, width, height);
    masker.endForeground();
    
    ofDisableAlphaBlending();
}

void ofApp::drawAnim() {
    masker.draw();
    bool allFinished = true;
    for(int i = 0; i < positions.size(); i++) {
        if(positions.at(i).getPlayCount() < 1) {
            allFinished = false;
        }
    }
    if(allFinished) renderGif();
}
    

Vacation Day 1

Daily sketch