本帖最后由 lisper 于 2016-4-11 17:19 编辑
- /*
- author: lisper <leyapin@gmail.com> 2015
- desc: 舞动的彩虹森林
- */
-
- float nx = 0;
- float ny = 0;
- float nz = 0;
-
- void setup () {
- size (600, 600);
- colorMode (HSB);
- }
-
-
- void draw () {
- background (0);
- drawStream ();
- }
-
- void drawStream () {
- float angle;
- int step = 10;
- int leng = step*5;
- nx = 0;
- for (int i=0; i<width; i+=step) {
- ny = 0;
- for (int j=0; j<width; j+=step) {
- angle = map (noise (nx, ny, nz), 0, 1.0, 0, 7*PI);
- float x = leng * cos (angle);
- float y = leng * sin (angle);
- stroke ( map (angle, 0, 6*PI, 0, 255), 255, 255);
- line (i, j, i+x, j+y);
- ny += 0.05;
- }
- nx += 0.05;
- }
- nz +=0.01;
- }
复制代码
|