[ Video ]
[ About ]
円を重ねを円形に配置して、Noise関数で個数を変更しています。
[ 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 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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(30); ofBackground(39); ofSetWindowTitle("Insta"); ofNoFill(); ofSetColor(239); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); int deg_span = 8; ofRotate(deg_span * 0.5f); float radius = 150; float small_radius = 0; for (int i = 0; radius < 330; i++) { if (small_radius == 0) { ofPoint p1 = ofPoint(radius * cos(0), radius * sin(0)); ofPoint p2 = ofPoint(radius * cos(deg_span * DEG_TO_RAD), radius * sin(deg_span * DEG_TO_RAD)); small_radius = p1.distance(p2) * 0.5; } for (int deg = 0; deg < 360 - deg_span; deg += deg_span) { float noise_value = ofMap(ofNoise(i * 0.1, deg * 0.02 + ofGetFrameNum() * 0.03), 0, 1, 1, 10); ofPoint point = ofPoint(radius * cos(deg * DEG_TO_RAD), radius * sin(deg * DEG_TO_RAD)); for (int tmp_noise_value = 0; tmp_noise_value <= noise_value; tmp_noise_value += 2) { ofDrawCircle(point, small_radius * tmp_noise_value * 0.1); } } float next_small_radius = 0; float tmp_radius = radius; while (radius < tmp_radius + small_radius + next_small_radius) { ofPoint p1 = ofPoint(radius * cos(0), radius * sin(0)); ofPoint p2 = ofPoint(radius * cos(deg_span * DEG_TO_RAD), radius * sin(deg_span * DEG_TO_RAD)); next_small_radius = p1.distance(p2) * 0.5; radius += 0.1; } small_radius = next_small_radius; } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |