[ Video ]
[ About ]
SNSで円周上から線が伸びて綺麗な模様を作っていらっしゃる方がいたのでマネし(パクり)ました。個人的には青色が好み。
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#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 61 62 63 64 65 66 67 68 69 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(30); ofBackground(39); ofSetWindowTitle("Insta"); ofNoFill(); ofSetColor(239, 39, 39, 139); // ofSetColor(39, 239, 39, 139); // ofSetColor(39, 39, 239, 139); ofEnableBlendMode(ofBlendMode::OF_BLENDMODE_ADD); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); float radius = 200; for (int deg_param = 0; deg_param < 360 * 2; deg_param += 1) { float deg = deg_param + 0.5; float x = radius * cos(deg * DEG_TO_RAD); float y = radius * sin(deg * DEG_TO_RAD); ofPushMatrix(); ofTranslate(x, y); ofBeginShape(); float line_y = 0; while (line_y > -ofGetHeight() / 2 - y) { float noise_value = ofNoise(x * 0.005, y * 0.005, line_y * 0.0005 + ofGetFrameNum() * 0.005); if (noise_value < 0.45) { break; } float line_x = ofMap(noise_value, 0, 1, -ofGetWidth(), ofGetWidth()); if (line_y == 0) { ofTranslate(-line_x, 0); } ofVertex(ofPoint(line_x, line_y)); line_y -= ofMap(noise_value, 0, 1, 0, 1.5); } ofEndShape(); ofPopMatrix(); } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |