[ Video ]
[ About ]
ターゲットサークル。
Target circles.
[ 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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofSetWindowTitle("openFrameworks"); ofBackground(0); ofNoFill(); ofSetLineWidth(2); ofSetCircleResolution(60); } //-------------------------------------------------------------- void ofApp::update() { ofSeedRandom(39); } //-------------------------------------------------------------- void ofApp::draw() { ofTranslate(ofGetWindowSize() * 0.5); auto frame_param = ofGetFrameNum() % 180; auto noise_param = frame_param < 60 ? ofMap(frame_param, 0, 60, 0, 1) : frame_param < 90 ? 1 : frame_param < 150 ? ofMap(frame_param, 90, 150, 1, 0) : 0; for (int i = 0; i < 4; i++) { auto x = ofMap(ofNoise(ofRandom(1000), ofGetFrameNum() * 0.01), 0, 1, -360, 360) * noise_param; auto y = ofMap(ofNoise(ofRandom(1000), ofGetFrameNum() * 0.01), 0, 1, -360, 360) * noise_param; ofDrawCircle(x, y, 65); auto deg = ofMap(i, 0, 4, 0, 180); ofDrawLine(glm::vec2(x + 50 * cos(deg * DEG_TO_RAD), y + 50 * sin(deg * DEG_TO_RAD)), glm::vec2(x + 80 * cos(deg * DEG_TO_RAD), y + 80 * sin(deg * DEG_TO_RAD))); ofDrawLine(glm::vec2(x + 50 * cos((deg + 180) * DEG_TO_RAD), y + 50 * sin((deg + 180) * DEG_TO_RAD)), glm::vec2(x + 80 * cos((deg + 180) * DEG_TO_RAD), y + 80 * sin((deg + 180) * DEG_TO_RAD))); } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |