[ Video ]
[ About ]
数字の漢字。
Numeric Kanji.
[ 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 27 |
#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) {}; ofEasyCam cam; ofTrueTypeFont font; vector<string> words; float noise_param; }; |
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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofSetWindowTitle("openFrameworks"); ofBackground(239); ofSetColor(39); ofTrueTypeFontSettings font_settings("fonts/msgothic.ttc", 22); font_settings.antialiased = true; font_settings.addRanges(ofAlphabet::Japanese); this->font.load(font_settings); this->words = { u8"零", u8"壱", u8"弐", u8"参", u8"肆", u8"肆", u8"漆", u8"捌", u8"玖", u8"拾", }; } //-------------------------------------------------------------- void ofApp::update() { ofSeedRandom(39); if (ofGetFrameNum() % 120 < 75) { this->noise_param += ofMap(ofGetFrameNum() % 60, 0, 75, 0.04, 0); } } //-------------------------------------------------------------- void ofApp::draw() { for(int x = 100; x <= ofGetWidth() - 100; x += 30){ for(int y = 100; y <= ofGetHeight() - 100; y += 30){ auto location = glm::vec2(x, y); int noise_value = ofMap(ofNoise(location.x * 0.003, location.y * 0.003, this->noise_param), 0, 1, 0, this->words.size()); this->font.drawString(this->words[noise_value], x - 11, y + 11); } } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |