[ Video ]
[ About ]
sin関数とcos関数を使ってxとyを求めながら、円を描書いていきます。
加えて、noise関数でz座標を計算して一部が飛び出た円にしてみました。
[ Source ]
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #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) {}; 		ofEasyCam cam; }; | 
| 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 | #include "ofApp.h" //-------------------------------------------------------------- int main() { 	ofSetupOpenGL(720, 720, OF_WINDOW); 	ofRunApp(new ofApp()); } //-------------------------------------------------------------- void ofApp::setup() { 	ofSetFrameRate(30); 	ofBackground(255); 	ofSetWindowTitle("Insta"); } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw() { 	this->cam.setPosition(ofVec3f(0, -1024, 768)); 	this->cam.setTarget(ofVec3f(0, 0, 0)); 	this->cam.begin(); 	float radius = 300; 	float x, y, z; 	float noise_value; 	ofVec3f point, prev_point; 	for (int i = 0; i < 30; i++) { 		for (int deg = 0; deg <= 360; deg += 1) { 			x = radius * cos(deg * DEG_TO_RAD); 			y = radius * sin(deg * DEG_TO_RAD); 			noise_value = ofNoise(x * 0.01, y * 0.01, (ofGetFrameNum() - i) * 0.015); 			if (noise_value > 0.5) { 				z = 512 * round(noise_value * 10) / 10.f; 			} 			else { 				z = 512 * 0.5; 			} 			x = (radius + i * 30) * cos(deg * DEG_TO_RAD); 			y = (radius + i * 30) * sin(deg * DEG_TO_RAD); 			point = ofVec3f(x, y, z); 			if (deg != 0) { 				ofSetColor(0, 255 - i * 8.5); 				ofDrawLine(point, prev_point); 			} 			prev_point = point; 		} 	} 	this->cam.end(); } | 
[ Link ]
https://github.com/junkiyoshi/Insta20171012
こんな感じで動画とソースを併せて記載できればいいかなと思います。