Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- int rez=10;
- long nS = (long) random(12345);
- void setup() {
- size(540, 540);
- img = loadImage("pic.jpg");
- image(img, 0, 0);
- surface.setResizable(true);
- surface.setSize(img.width, img.height);
- //pixelNoise();
- }
- void draw() {
- pixelNoise();
- }
- void pixelNoise() {
- noiseSeed(nS);
- image(img, 0, 0);
- float yOff = 0;
- for (int x=0; x<img.width; x +=rez) {
- float xOff=0;
- for (int y=0; y<img.height; y+=rez) {
- color c = img.get(x+rez/2, y+rez/2);
- fill(c);
- stroke(255, 50);
- float ns = noise(xOff, yOff);
- if (ns>0.5) {
- fill(c);
- stroke(255, 50);
- rect(x, y, rez, rez);
- }
- ns = noise(xOff-0.8, yOff+0.7);
- if (ns>0.7) {
- fill(255);
- noStroke();
- rect(x, y, rez, rez);
- }
- xOff += 0.05;
- }
- yOff += 0.06;
- }
- }
- void mouseClicked() {
- nS = (long) random(12345);
- }
- void keyPressed() {
- save(random(1234)+".jpg");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement