[ Video ]
[ About ]
Noiseの値を動画のフレーム数に置き換えて、ピルセルごとで時間の歪みがある動画を作った事があったのですが、そもそも直感的にわかる時計に置き換えたら面白いかなと思い付き。
良き。
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#pragma once #include "ofMain.h" class ofApp : public ofBaseApp { public: void setup(); void update(); void draw(); void keyPressed(int key) {}; void keyReleased(int key) {}; void mouseMoved(int x, int y) {}; void mouseDragged(int x, int y, int button) {}; void mousePressed(int x, int y, int button) {}; void mouseReleased(int x, int y, int button) {}; void windowResized(int w, int h) {}; void dragEvent(ofDragInfo dragInfo) {}; void gotMessage(ofMessage msg) {}; // Make Method void draw_clock(ofPoint point, int minute, int radius); // Make Variable ofTrueTypeFont font; }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofBackground(239); ofSetWindowTitle("Insta"); ofNoFill(); ofEnableSmoothing(); ofSetColor(39); this->font.loadFont("fonts/Kazesawa-Extrabold.ttf", 16, true, false, true); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { int span = 60; for (int x = span; x < ofGetWidth() + span; x += span * 2) { for (int y = span; y < ofGetHeight() + span; y += span * 2) { int minute = ofNoise(x * 0.005, y * 0.005, ofGetFrameNum() * 0.005) * 720; this->draw_clock(ofPoint(x, y), minute, span * 0.95); } } } //-------------------------------------------------------------- void ofApp::draw_clock(ofPoint point, int minute, int radius){ ofPushMatrix(); ofTranslate(point); ofNoFill(); ofBeginShape(); for (int deg = 0; deg < 360; deg += 1) { ofVertex(radius * cos(deg * DEG_TO_RAD), radius * sin(deg * DEG_TO_RAD)); } ofEndShape(true); int time = minute / 60; minute = minute - time * 60; int time_deg = time * 30 + ofMap(minute, 0, 59, 0, 30); int minute_deg = minute * 6; ofSetLineWidth(5); ofDrawLine(ofPoint(), ofPoint(radius * 0.6 * cos(time_deg * DEG_TO_RAD), radius * 0.6 * sin(time_deg * DEG_TO_RAD))); ofSetLineWidth(3); ofDrawLine(ofPoint(), ofPoint(radius * 0.8 * cos(minute_deg * DEG_TO_RAD), radius * 0.8 * sin(minute_deg * DEG_TO_RAD))); ofFill(); ofDrawCircle(ofPoint(), 5); ofPopMatrix(); } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |
[ Link ]
https://github.com/junkiyoshi/Insta20180405