Advertisement
xeromino

typeFace

Mar 9th, 2017
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. PImage img;
  2.  
  3. void setup() {
  4.   size(100, 100);
  5.   img = loadImage("pic.jpg");
  6.   surface.setResizable(true);
  7.   surface.setSize(img.width, img.height);
  8.   background(255);
  9. }
  10.  
  11. void draw() {
  12.   for (int i=0; i<10; i++) {
  13.     float x = random(width);
  14.     float y = random(height);
  15.     color c = img.get(int(x), int(y));
  16.     float br = brightness(c);
  17.     noStroke();
  18.     fill(br, 150);
  19.     if (random(1)>0.95) {
  20.       if (br > 75) {
  21.         fill(0, 150);
  22.       } else {
  23.         fill(255, 200);
  24.       }
  25.     }
  26.     float sz = map(br, 0, 180, 20, 5)*random(0.5, 1);
  27.     textSize(sz);
  28.     if (br<180) text(char(int(random(97, 122))), x, y);
  29.   }
  30. }
  31.  
  32. void keyPressed() {
  33.   saveFrame("image-###.png");
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement