Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //// Some noise stuff by Stefan Petrick
- //// written in Processing 4, meant to be used with FastLED
- void setup() {
- fullScreen();
- //size(820, 820);
- background(0);
- }
- float scale = 10; // the zoom factor for the layers
- float scale2 = 5;
- float c, d, time;
- float shift1, shift2;
- float r, g, b;
- int num_x = 16;
- int num_y = 16;
- int rct = 50;
- int sz = 40;
- void draw() {
- time = millis(); // lets have the animation speed independent from the framerate
- time = time *3; // global speed setting, could also be time/5 or anything
- c = time / 3000; // speeds of the linear scrollings relative to global speed
- d = time / 7000;
- for (int x = 0; x < num_x; x++) {
- for (int y = 0; y < num_y; y++) {
- shift1 = g/2000;
- shift2 = r/1000;
- r = noise( (x)/scale +shift1, (y/scale) + c +shift2+shift1);
- r = map(r, 0.3, 0.8, 0, 255);
- g = noise( (x/scale) +shift2, (y/scale) + d );
- g = map(g, 0.3, 0.7, 0, 255);
- b = noise( (x/scale2) + shift1, (y/scale2) + shift2 );
- b = map(b, 0.3, 0.7, 0, 255);
- fill( (b*r) / 255, b-g, (b-r) * g/255 );
- rect( 20+x*20, 20+y*20, 20, 20);
- fill( r*y/15, 0, (g-b/2)*y/15);
- rect( 400+x*20, 20+y*20, 20, 20);
- fill( r, g, 0 );
- rect( 840+x*10, 200+y*10, 10, 10);
- fill( 0, g, b );
- rect( 1040+x*10, 200+y*10, 10, 10);
- fill( r, 0, b );
- rect( 1240+x*10, 200+y*10, 10, 10);
- fill( r-b, 0, 0 );
- rect( 840+x*10, 400+y*10, 10, 10);
- fill( 0, g-b, 0 );
- rect( 1040+x*10, 400+y*10, 10, 10);
- fill( 0, 0, b-r );
- rect( 1240+x*10, 400+y*10, 10, 10);
- fill( r*(b/255), 0, 0 );
- rect( 840+x*10, 600+y*10, 10, 10);
- fill( r*(b/255), g*r/255, 0 );
- rect( 1040+x*10, 600+y*10, 10, 10);
- fill( r, g, b );
- rect( 1240+x*10, 600+y*10, 10, 10);
- fill(r, 0, 0);
- rect(840+x*10, y*10, 10, 10);
- fill(0, g, 0);
- rect(1040+x*10, y*10, 10, 10);
- fill(0, 0, b);
- rect(1240+x*10, y*10, 10, 10);
- }
- }
- updatePixels();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement