Skip to content

Instantly share code, notes, and snippets.

@loveandsheep
Last active August 29, 2015 13:56
Show Gist options
  • Save loveandsheep/9166251 to your computer and use it in GitHub Desktop.
Save loveandsheep/9166251 to your computer and use it in GitHub Desktop.
MultiMeshDistort Example
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