Created
May 4, 2014 16:30
-
-
Save ofZach/306332b864e3d92aa399 to your computer and use it in GitHub Desktop.
perlin circle
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
for hiro | |
//-------------------------------------------------------------- | |
void testApp::draw(){ | |
ofSetColor(255,0,127); | |
ofBeginShape(); | |
for (int i = 0; i < 1000; i++){ | |
//float add = ofNoise(sin((i/100.0)*TWO_PI), ofGetElapsedTimef()); // symetrical | |
//cout << i << " " << (i + 500) % 1000 << endl; | |
int i2 = (i + 500) % 1000; | |
float add = ofNoise(i/100.0f, ofGetElapsedTimef() * 3 * (float)mouseX / (float)ofGetWidth()); | |
float add2 = ofNoise(i2/100.0f + 1000, ofGetElapsedTimef() * 3 * (float)mouseX / (float)ofGetWidth()); | |
float pct = sin(ofMap( i / 1000.0, 0.25, 0.75, 0, 1, true) * PI); | |
float pct2 = 1 - sin(ofMap( i / 1000.0, 0.25, 0.75, 0, 1, true) * PI); | |
ofVertex( 500 + (200 + 100 * add2 * pct2 + 100 * add * pct) * cos((i/1000.0)*TWO_PI), | |
400 + (200 + 100 * add2 * pct2 + 100 * add * pct) * sin((i/1000.0)*TWO_PI)); | |
} | |
ofEndShape(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment