[ Video ]
[ About ]
スライダー状の辺を円形に並べました
I put slider on round shape.
[ 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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofSetWindowTitle("Insta"); ofBackground(39); ofSetLineWidth(3); ofSetColor(239); ofNoFill(); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { ofTranslate(ofGetWidth() * 0.5, ofGetHeight() * 0.5); int min_radius = 35; int max_radius = 110; int half_radius = (min_radius + max_radius) * 0.5; ofColor line_color; for (int x = -1; x <= 1; x++) { for (int y = -1; y <= 1; y++) { ofPoint location = ofPoint(x * 240, y * 240); for (int deg = 0; deg < 360; deg += 12) { ofPoint min_point = ofPoint(min_radius * cos(deg * DEG_TO_RAD), min_radius * sin(deg * DEG_TO_RAD)) + location; ofPoint max_point = ofPoint(max_radius * cos(deg * DEG_TO_RAD), max_radius * sin(deg * DEG_TO_RAD)) + location; ofPoint half_point = ofPoint(half_radius * cos(deg * DEG_TO_RAD), half_radius * sin(deg * DEG_TO_RAD)) + location; float noise_value = ofNoise(half_point.x * 0.01, half_point.y * 0.01, ofGetFrameNum() * 0.01); float noise_radius = ofMap(noise_value, 0, 1, min_radius, max_radius); ofPoint noise_point = ofPoint(noise_radius * cos(deg * DEG_TO_RAD), noise_radius * sin(deg * DEG_TO_RAD)) + location; ofPoint min_noise_point = ofPoint((noise_radius - 10) * cos(deg * DEG_TO_RAD), (noise_radius - 10) * sin(deg * DEG_TO_RAD)) + location; ofPoint max_noise_point = ofPoint((noise_radius + 10) * cos(deg * DEG_TO_RAD), (noise_radius + 10) * sin(deg * DEG_TO_RAD)) + location; ofDrawCircle(noise_point, 2.5); ofDrawLine(min_point, min_noise_point); ofDrawLine(max_point, max_noise_point); } } } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |