[ Video ]
[ About ]
4つの円の円周上の座標を線で結んでいます。円ごとに90度づつズレがあり、独特の歪みと周期があって面白い。
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#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 mouseEntered(int x, int y) {} void mouseExited(int x, int y) {} void windowResized(int w, int h) {} void dragEvent(ofDragInfo dragInfo) {} void gotMessage(ofMessage msg) {} }; |
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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofBackground(39); ofSetWindowTitle("Insta"); ofEnableBlendMode(ofBlendMode::OF_BLENDMODE_ADD); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { ofPoint point_left = ofPoint(ofGetWidth() / 6 * 1, ofGetHeight() / 2); ofPoint point_right = ofPoint(ofGetWidth() / 6 * 5, ofGetHeight() / 2); ofPoint point_top = ofPoint(ofGetWidth() / 2, ofGetHeight() / 6 * 1); ofPoint point_bottom = ofPoint(ofGetWidth() / 2, ofGetHeight() / 6 * 5); float radius = 100; ofColor color; for (int deg = 0; deg < 360; deg += 15) { color.setHsb(ofMap(deg % 360, 0, 359, 0, 255), 239, 239); ofSetColor(color); int deg_left = deg + ofGetFrameNum() * 0.5; int deg_top = deg_left + 90; int deg_right = deg_top + 90; int deg_bottom = deg_right + 90; ofPoint mini_point_left = point_left + ofPoint(radius * cos(deg_left * DEG_TO_RAD), radius * sin(deg_left * DEG_TO_RAD)); ofPoint mini_point_top = point_top + ofPoint(radius * cos(deg_top * DEG_TO_RAD), radius * sin(deg_top * DEG_TO_RAD)); ofPoint mini_point_right = point_right + ofPoint(radius * cos(deg_right * DEG_TO_RAD), radius * sin(deg_right * DEG_TO_RAD)); ofPoint mini_point_bottom = point_bottom + ofPoint(radius * cos(deg_bottom * DEG_TO_RAD), radius * sin(deg_bottom * DEG_TO_RAD)); ofDrawCircle(mini_point_left, 3); ofDrawCircle(mini_point_top, 3); ofDrawCircle(mini_point_right, 3); ofDrawCircle(mini_point_bottom, 3); ofDrawLine(mini_point_left, mini_point_top); ofDrawLine(mini_point_top, mini_point_right); ofDrawLine(mini_point_right, mini_point_bottom); ofDrawLine(mini_point_bottom, mini_point_left); } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |