[ Video ]
[ About ]
X軸に平行な線を等間隔に描写していきます。
ただし、下記の二つのフールを追加しています。
1. Y座標 + Frame数を引数としたNoise関数の結果により線のX座標がずれる
2. 中心座標からの距離が一定以内の場合は描写しない
割と、はっきり円の輪郭が見えてくるのが個人的にツボです。
[ 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 | #include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { 	ofSetFrameRate(60); 	ofBackground(239); 	ofSetWindowTitle("Insta"); 	ofSetColor(39); 	ofSetLineWidth(2); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { 	ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); 	int radius = 250; 	int line_length = 380; 	for (int y = -ofGetHeight() / 2; y <= ofGetHeight() / 2; y += 5) { 		int x_start = ofNoise(y * 0.02 + ofGetFrameNum() * 0.01) * -line_length; 		for (int x = x_start; x <= x_start + line_length; x += 1) { 			if (ofPoint(x, y).length() > radius) { 				ofDrawLine(ofPoint(x, y), ofPoint(x + 1, y)); 			} 		} 	} } //-------------------------------------------------------------- int main() { 	ofSetupOpenGL(720, 720, OF_WINDOW); 	ofRunApp(new ofApp()); } |