Last active
August 29, 2015 13:56
-
-
Save loveandsheep/9166251 to your computer and use it in GitHub Desktop.
MultiMeshDistort Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MultiMeshDistort multiMesh; | |
void testApp::update(){ | |
//マウス追従します。multiMesh.update(true);でも同じ処理を試せます | |
clearPoint(); | |
addPoint(ofVec2f(ofGetMouseX(),ofGetMouseY()), | |
200.0, | |
sin(ofGetElapsedTimef())*50.0+50.0, false); | |
addPoint(ofVec2f(ofGetWidth() - ofGetMouseX(), | |
ofGetHeight() - ofGetMouseY()), | |
200.0, | |
sin(ofGetElapsedTimef())*50.0+50.0, true); | |
} | |
void testApp::draw(){ | |
ofBackground(0); | |
ofNoFill(); | |
ofSetColor(255); | |
for (int i = 0;i < ofGetWidth();i+=10){ | |
ofBeginShape(); | |
for (int j = 0;j < ofGetHeight();j+=2){ | |
//頂点位置をmultiMesh::getPoint()で変換して、代入 | |
ofVec2f p = multiMesh.getPoint(ofVec2f(i,j)); | |
ofCurveVertex(p.x, p.y); | |
} | |
ofEndShape(); | |
} | |
ofFill(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment