[ Video ]
[ About ]
ニュースでマトリックスの名前を久々に見たので
[ 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) {}; ofTrueTypeFont font; int font_size; int font_span; string moji; }; |
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 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofBackground(0); ofSetWindowTitle("Insta"); this->font_size = 20; this->font_span = 27; this->font.loadFont("fonts/Kazesawa-Bold.ttf", this->font_size); this->moji = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { for (int x = this->font_span / 2; x < ofGetWidth() - this->font_span / 2; x += this->font_span) { for (int y = -this->font_size / 2; y < ofGetHeight() + this->font_span / 2; y += this->font_span) { float noise_value = ofNoise(x, y * 0.0025 - ofGetFrameNum() * 0.025); ofSetColor(0, 255 , 0, 255 * noise_value); this->font.drawString(this->moji.substr((x / this->font_span) % 26, 1), x, y); } } } //-------------------------------------------------------------- int main() { ofSetupOpenGL(1920, 1080, OF_WINDOW); ofRunApp(new ofApp()); } |