Muestra las diferencias entre dos versiones de la página.
| Próxima revisión | Revisión previa | ||
|
wiki2:cpp:libraries:openframeworks:snippets [2015/10/09 14:35] alfred creado |
wiki2:cpp:libraries:openframeworks:snippets [2020/05/09 09:25] (actual) |
||
|---|---|---|---|
| Línea 50: | Línea 50: | ||
| * Juego con rangos de colores | * Juego con rangos de colores | ||
| - | <code> | + | <code cpp> |
| ofBackground( 255, 255, 255 ); | ofBackground( 255, 255, 255 ); | ||
| // Rango de negro a rojo | // Rango de negro a rojo | ||
| Línea 73: | Línea 73: | ||
| ofLine( i, 160, i, 210 ); | ofLine( i, 160, i, 210 ); | ||
| } | } | ||
| + | </code> | ||
| + | |||
| + | * Jugar con noise | ||
| + | |||
| + | <code cpp> | ||
| + | ofBackground(0,0,0); | ||
| + | ofSetColor(255); | ||
| + | |||
| + | ofNoFill(); | ||
| + | ofBeginShape(); | ||
| + | for (int i = 0; i < 500; i++){ | ||
| + | | ||
| + | float x = i; | ||
| + | float noise = ofNoise(i/10.0); | ||
| + | float y = ofMap(noise, 0,1, 0, 100); | ||
| + | ofVertex(x,y); | ||
| + | } | ||
| + | ofEndShape(); | ||
| + | |||
| + | /* | ||
| + | If you alter the i/10.0, you can adjust the scale of the noise, either zooming in (ie, i/100.0), so you see more details, or zooming out (ie, i/5.0) so you see more variation. | ||
| + | |||
| + | Or with: | ||
| + | float y = ofMap(noise, 0,1, 0, 3) + 10; | ||
| + | to emulate the XKCD trace. | ||
| + | |||
| + | Or with | ||
| + | float noise = ofNoise(i*ofRandomf()/10.0); | ||
| + | To make it animate. Or another way to animate it: | ||
| + | float x = ofMap( ofNoise( ofGetElapsedTimef()), 0, 1, 0, ofGetWidth()); | ||
| + | ofCircle(x,200,30); | ||
| + | */ | ||
| </code> | </code> | ||