[ Video ]
[ About ]
線の重なり。
Line overlap.
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
#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) {}; }; |
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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofSetWindowTitle("openFrameworks"); ofBackground(0); ofSetColor(30, 10, 10); ofSetLineWidth(0.5); ofNoFill(); ofEnableBlendMode(ofBlendMode::OF_BLENDMODE_ADD); } //-------------------------------------------------------------- void ofApp::update() { ofSeedRandom(39); } //-------------------------------------------------------------- void ofApp::draw() { int radius = 100; float handle_len = radius; int number_of_location = 4; int deg_span = 360 / number_of_location; for (int x = 200; x <= ofGetWidth(); x += 320) { for (int y = 200; y <= ofGetHeight(); y += 320) { for (int i = 0; i < 200; i++) { vector<glm::vec2> location_list; vector<float> deg_list; for (int deg = 0; deg < 360; deg += deg_span) { location_list.push_back(glm::vec2(x + radius * cos(deg * DEG_TO_RAD), y + radius * sin(deg * DEG_TO_RAD))); deg_list.push_back(deg + 90); } for (int k = 0; k < location_list.size(); k++) { deg_list[k] += ofMap(ofNoise(location_list[k].x, location_list[k].y, ofGetFrameNum() * 0.01 + i * 0.001), 0, 1, -90, 90); } ofBeginShape(); for (int i = 0; i < location_list.size(); i++) { int n = (i + 1) % location_list.size(); ofVertex(location_list[i]); ofBezierVertex( location_list[i] + glm::vec2(handle_len * cos(deg_list[i] * DEG_TO_RAD), handle_len * sin(deg_list[i] * DEG_TO_RAD)), location_list[n] + glm::vec2(handle_len * cos((deg_list[n] + 180) * DEG_TO_RAD), handle_len * sin((deg_list[n] + 180) * DEG_TO_RAD)), location_list[n]); } ofEndShape(); } } } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |