[ Video ]
[ About ]
パーリンノイズ(x座標 + y座標, フレーム番号)で生成した色で着色した円
Circle color is determined by Perlin Noise (x + y, frame number).
[ Source ]
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  | 
						#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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65  | 
						#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { 	ofSetFrameRate(60); 	ofSetWindowTitle("openframeworks"); 	ofBackground(39); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { 	int radius = 70; 	int circle_width = radius * 0.25; 	int deg_span = 15; 	for (int x = 72; x < ofGetWidth(); x += 144) { 		for (int y = 72; y < ofGetHeight(); y += 144) { 			ofPushMatrix(); 			ofTranslate(x, y); 			for (int deg = 0; deg < 360; deg += deg_span) { 				ofColor color; 				ofPoint color_point(x + radius * cos((deg + deg_span * 0.5) * DEG_TO_RAD), y + radius * sin((deg + deg_span * 0.5) * DEG_TO_RAD)); 				float noise_value = ofNoise(color_point.x * 0.01 + color_point.y * 0.01, ofGetFrameNum() * 0.01) * 255; 				color.setHsb(noise_value, 200, 255); 				ofSetColor(color); 				vector<ofPoint> vertices; 				for (int d = deg; d <= deg + deg_span; d++) { 					vertices.push_back(ofPoint(radius * cos(d * DEG_TO_RAD), radius * sin(d * DEG_TO_RAD))); 				} 				for (int d = deg + deg_span; d >= deg; d--) { 					vertices.push_back(ofPoint((radius - circle_width)  * cos(d * DEG_TO_RAD), (radius - circle_width) * sin(d * DEG_TO_RAD))); 				} 				ofBeginShape(); 				ofVertices(vertices); 				ofEndShape(true); 			} 			ofPopMatrix(); 		} 	} } //-------------------------------------------------------------- int main() { 	ofSetupOpenGL(720, 720, OF_WINDOW); 	ofRunApp(new ofApp()); }  |