Advertisement
xeromino

ex18

Jul 3rd, 2015
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. int step=2;
  2.  
  3. void setup() {
  4.   size(800, 450);
  5.   colorMode(HSB,360,100,100);
  6.   createStuff();
  7. }
  8.  
  9. void draw() {
  10. }
  11.  
  12. void keyPressed() {
  13.   save(random(123)+".jpg");
  14. }
  15.  
  16. void mouseReleased() {
  17.   createStuff();
  18. }
  19.  
  20. void createStuff() {
  21.   float sx = random(10000);
  22.   float sy = random(10000);
  23.  
  24.   float xOff = sx;
  25.   for (int x=0; x<width; x+=step) {
  26.     float yOff = sy;
  27.     for (int y=0; y<height; y+=step) {
  28.       int col = (int) map(noise(xOff, yOff), 0, 1, 0,360);
  29.       fill(col,90,90);
  30.       noStroke();
  31.       rect(x, y, step, step);
  32.       yOff += 0.005;
  33.     }
  34.     xOff += 0.005;
  35.   }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement