[ Video ]
[ About ]
円の透過度を下げながら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 25 26  | 
						#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) {}; 	// Make Member 	ofEasyCam cam; 	// Make Method 	void draw_circles(ofPoint point, ofColor color); };  | 
					
| 
					 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 73 74 75 76 77 78 79  | 
						#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { 	ofSetFrameRate(60); 	ofBackground(239); 	ofSetWindowTitle("Insta"); 	ofNoFill(); 	ofSetLineWidth(3); 	ofEnableDepthTest(); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { 	this->cam.begin(); 	this->draw_circles(ofPoint(-110, 0), ofColor(39)); 	ofRotateX(180); 	this->draw_circles(ofPoint(110, 0), ofColor(39)); 	this->cam.end(); } //-------------------------------------------------------------- void ofApp::draw_circles(ofPoint point, ofColor color) { 	// Translate Coordinate 	ofPushMatrix(); 	ofTranslate(point); 	// Initialize Param Variable 	int radius = 100; 	int circle_span = 20; 	int number_of_circle = 13; 	// Draw Circles 	for (int i = 0; i < number_of_circle; i++) { 		float z = i * circle_span + (int)(ofGetFrameNum() * 0.5) % circle_span; 		ofSetColor(color, ofMap(z, 0, circle_span * number_of_circle, 255, 0)); 		ofBeginShape(); 		for (int deg = 0; deg < 360; deg++) { 			float x = radius * cos(deg * DEG_TO_RAD); 			float y = radius * sin(deg * DEG_TO_RAD); 			ofVertex(x, y, z); 		} 		ofEndShape(true); 	} 	// Draw Bottom Circle 	ofSetColor(color, ofMap((int)(ofGetFrameNum() * 0.5) % circle_span, 0, circle_span, 0, 255)); 	ofBeginShape(); 	for (int deg = 0; deg < 360; deg++) { 		float x = radius * cos(deg * DEG_TO_RAD); 		float y = radius * sin(deg * DEG_TO_RAD); 		ofVertex(x, y, 0); 	} 	ofEndShape(true); 	ofPopMatrix(); } //-------------------------------------------------------------- int main() { 	ofSetupOpenGL(720, 720, OF_WINDOW); 	ofRunApp(new ofApp()); }  |