SketchPad

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

Daily Sketches

Sketch 2015-05-05

        void ofApp::setupAnim() {
    for(int i = 5; i > 0; i--) {
        vector<ofxShape> shapeLayer;
        
        for(int j = 0; j < i; j++) {
            ofxAnimatableFloat positionZ;
            positionZ.reset(-i);
            positionZ.animateToAfterDelay(i * 30, j);
            positionZ.setDuration(1.2);
            positionZ.setCurve(EASE_IN_OUT_BOUNCE);
            positionZ.setRepeatType(LOOP_BACK_AND_FORTH_ONCE);
            positionsZ.push_back(positionZ);
            
            for(int k = 0; k < i; k++) {
                size = (width / i) * 0.38;
                
                ofxShape shape;
                shape.setupFilledRing(60, size);
                shape.setBlur(15);
                shape.positionX(((width / i) * j) + (width / i / 2));
                shape.positionY(((height / i) * k) + (height / i / 2));
                shape.setColor(ofColor::fromHsb(255 / i, 128, 128));
                shapeLayer.push_back(shape);
            }
        }
        
        shapes.push_back(shapeLayer);
    }

    for(int i = 0; i < shapes.size(); i++) {
        for(int j = 0; j < shapes.at(i).size(); j++) {
            shapeSystem.add(shapes.at(i).at(j));
        }
    }
}

void ofApp::updateAnim(){
    for(int i = 0; i < positionsZ.size(); i++) {
        positionsZ.at(i).update(1.0f/framerate);
    }
    
    for(int i = 0; i < shapes.size(); i++) {
        for(int j = 0; j < shapes.at(i).size(); j++) {
            shapes.at(i).at(j).positionZ(positionsZ.at(i).val());
        }
    }
    
    shapeSystem.update();
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);
    ofEnableBlendMode(OF_BLENDMODE_ADD);
    shapeSystem.draw();
    ofDisableBlendMode();
    
    if(ofGetFrameNum() == 64) {
        renderGif();
    }
}
    

Wheels within wheels, and nested loops.

Daily sketch