Shape - "Hello,Shape"
来源:互联网 发布:知乎长期光头 编辑:程序博客网 时间:2024/06/05 05:19
/* * MOUSE * position x : length * position y : thickness and number of lines * drag : draw */ofColor col;bool bClear = false;//--------------------------------------------------------------void testApp::setup(){ ofSetWindowShape(720, 720); ofNoFill(); ofBackground(255); ofSetBackgroundAuto(false); // col = ofColor(0);}//--------------------------------------------------------------void testApp::update(){ }//--------------------------------------------------------------void testApp::draw(){ // stupid method, fixed clear problem in mac if ( bClear ){ ofSetBackgroundAuto(true); ofClear(255); bClear = false; } else ofSetBackgroundAuto(false); ofEnableAlphaBlending(); if ( ofGetMousePressed()){ ofPushMatrix(); ofTranslate(ofGetWidth()*.5, ofGetHeight()*.5); int circle_res = ofMap(mouseX+100, 0, ofGetHeight(), 2, 10); float radius = mouseX - ofGetWidth()*.5 + 0.5; float angle = TWO_PI/circle_res; ofSetColor(col, 5); ofEnableSmoothing(); ofBeginShape(); for (int i = 0; i<=circle_res; i++) { float x = 0 + cos(angle*i) * radius; float y = 0 + sin(angle*i) * radius; ofVertex(x, y); } ofEndShape(); ofDisableSmoothing(); ofPopMatrix(); }}//--------------------------------------------------------------void testApp::keyPressed(int key){ if ( key == OF_KEY_BACKSPACE ) bClear = true; if ( key == 's' ) ofSaveScreen("C.png"); if ( key == 'r' ) col = ofColor(ofRandomuf()*255, ofRandomuf()*255, ofRandomuf()*255, 10);}
-GENERATIVE DESIGN-
- Shape - "Hello,Shape"
- shape
- Shape
- shape
- shape
- Shape
- shape
- shape
- shape
- shape
- shape
- shape
- shape
- Shape
- Shape
- shape
- shape
- Shape
- android ListView详解
- flexlib包 修改MDIWindow可以边界停靠
- 谷歌笔试1
- Applet总结
- Portal-Basic Java Web 应用开发框架:应用篇(八) —— 整合 Freemarker
- Shape - "Hello,Shape"
- java 阻塞模式与非阻塞模式
- IC设计
- SuperMap 插件
- 通向架构师的道路(第三天)之apache性能调优
- 推箱子_无操作系统
- Android中调用系统所装的软件打开文件
- C#中利用ODP实现瞬间导入百万级数据详解
- People Name Memo