Advertisement
Guest User

Code

a guest
May 27th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1. float noiseScale = 0.003;
  2.  
  3. PImage image1;
  4. PImage image2;
  5. PImage image3;
  6.  
  7. int iteration;
  8.  
  9. void setup()
  10. {
  11.   size(960, 540);
  12.   image1 = loadImage("image1.png");
  13.   image2 = loadImage("image2.png");
  14.   image3 = loadImage("image3.png");
  15.   iteration = 0;
  16.  
  17.   noiseSeed(10);
  18. }
  19.  
  20. void draw()
  21. {
  22.   loadPixels();
  23.  
  24.   for(int i = 0; i < width; i++)
  25.   {
  26.     for(int j = 0; j < height; j++)
  27.     {
  28.      
  29.       float noiseValue1 = noise(i * noiseScale,j * noiseScale, iteration * 0.01);
  30.       if(noiseValue1 < 0.46)
  31.         pixels[i + j * width] = image1.pixels[i + j * width];
  32.       if(noiseValue1 >= 0.46 && noiseValue1 < 0.55)
  33.         pixels[i + j * width] = image2.pixels[i + j * width];
  34.       if(noiseValue1 >= 0.55)
  35.         pixels[i + j * width] = image3.pixels[i + j * width];
  36.     }
  37.   }
  38.   updatePixels();
  39.   iteration++;
  40.   if(iteration < 900)
  41.   {
  42.     saveFrame("frames/frame-####.tif");
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement