[ Video ]
[ About ]
なみなみ。
Waves.
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(30); ofBackground(0); ofSetWindowTitle("Insta"); ofSetColor(255, 255, 0); ofSetLineWidth(2); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); ofRotate(90); float radius = 300; ofVec2f location_1, location_2; float y_span = 5; float noise_value = 0; for (float deg = 0; deg < 180; deg += 5) { location_1 = ofVec2f(radius * cos(deg * DEG_TO_RAD), radius * sin(deg * DEG_TO_RAD)); location_2 = ofVec2f(radius * cos(-deg * DEG_TO_RAD), radius * sin(-deg * DEG_TO_RAD)); for (float y = location_2.y; y < location_1.y; y += y_span) { ofLine(ofVec3f(location_1.x + ofMap(ofNoise(ofGetFrameNum() * 0.05 + y * 0.05), 0, 1, -25, 25), y, 0), ofVec3f(location_1.x + ofMap(ofNoise(ofGetFrameNum() * 0.05 + (y + y_span) * 0.05), 0, 1, -25, 25), y + y_span, 0)); } } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |