Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage img;
- void setup() {
- img = loadImage("https://s-media-cache-ak0.pinimg.com/736x/d1/cd/39/d1cd392fe6a250f8cc419f0d3eb43acb.jpg");
- size(img.width, img.height);
- img.filter(POSTERIZE, 10);
- background(20);
- noStroke();
- //image(img,0,0);
- }
- void draw() {
- for (int i=0; i<50; i++) {
- paintStroke();
- }
- }
- void paintStroke() {
- int tx = (int) random(width);
- int ty = (int) random(height);
- translate(tx, ty);
- color col = img.get(tx, ty);
- fill(col, 200);
- pushMatrix();
- rotate(random(TWO_PI));
- beginShape();
- float angle=0;
- float d = random(5, 20);
- for (int i=0; i<3; i++) {
- float x = cos(angle)*d;
- float y = sin(angle)*d;
- vertex(x, y);
- angle+=TWO_PI/3;
- }
- endShape(CLOSE);
- popMatrix();
- }
- void keyPressed() {
- save(random(1234)+".jpg");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement