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-30

        void ofApp::setupAnim() {
    coordinateSystemCenter = ofPoint(width * 0.5, height * 0.5);
    outerRadius = width * 0.4;
    innerRadius = width * 0.2;
    ofEnableAntiAliasing();
    ofEnableSmoothing();
    ofSetLineWidth(1);
    
    for(int i = 0; i < 30; i++) {
        innerSpread.push_back(i * 36 + ofRandom(18));
        outerSpread.push_back(i * 36 + 18 + ofRandom(18));
    }
}

void ofApp::drawAnim() {
    ofBackground(0, 0, 0);
    ofTranslate(coordinateSystemCenter);
    
    ofPushMatrix();
    ofRotateZ(-ofGetFrameNum());
    drawArc(innerRadius, 120);
    ofPopMatrix();
    
    ofPushMatrix();
    ofRotateZ(ofGetFrameNum());
    drawArc(outerRadius, 220);
    ofPopMatrix();
    
    for(int i = 0; i < 10; i++) {
        ofPushMatrix();
        ofRotateZ(innerSpread.at(i) + ofGetFrameNum() * 4);
        ofLine(0, -height*0.2, 0, -height*0.25);
        ofPopMatrix();
    }
    
    for(int i = 0; i < 20; i++) {
        ofPushMatrix();
        ofRotateZ(innerSpread.at(i) - ofGetFrameNum() * 4);
        ofLine(0, -height*0.25, 0, -height*0.3);
        ofPopMatrix();
    }
    
    for(int i = 0; i < 30; i++) {
        ofPushMatrix();
        ofRotateZ(innerSpread.at(i) - ofGetFrameNum() * 2);
        ofLine(0, -height*0.3, 0, -height*0.5);
        ofPopMatrix();
    }
    
    for(int i = 0; i < 20; i++) {
        ofPushMatrix();
        ofRotateZ(outerSpread.at(i) - ofGetFrameNum() * 2);
        ofLine(0, -height*0.45, 0, -height*0.5);
        ofPopMatrix();
    }
    
    if(ofGetFrameNum() == 360) {
        renderGif();
    }
}
    

The magic of transforms: translate, rotate, translate. The first translation kicks off your coordinate system.

Daily sketch