Code in 2010

Shanktacular Ipso Funktotem

shanktacularipsofunktotemshanktacular.png

A print for the AS220 Printshop’s 2010 Print Lottery.

shanktacularipsofunktotem2.png

Here’s the code:

import processing.pdf.*;

int r = 5;   
int rows = 20;
int cols = 80;
int w = cols * r*2;                                                                                                                            
int h = rows * r*2;
int p =10;
int repetitions = 5;
PImage img;
color fillColor;

float rads(float n) {                                                                                                                         
  return (n/180.0 * PI);                                                                                                                      
}                                                                                                                                             

void drawCircles(int ground, int n, int centerx, int centery, int radius) { 
  for (int rep=0; rep<n; rep++) { 
    if (ground == 0) {
      fillColor = color(  random(50)+100, random(50)+200, random(50)+150);
      fill(fillColor, random(255));
      stroke(fillColor, 200);
    } else {
      fillColor = color(  random(100), random(255), random(100));
      fill(fillColor, random(128));
      stroke(fillColor, 100);
    }

    int temp = int(random(2*p)-p);
    int offsetX = int(random(p));
    int offsetY = int(random(p));
    ellipse(centerx+offsetX, centery+offsetY, radius+temp, radius+temp);  
    ellipse(centerx+offsetX, centery+offsetY, (radius+temp)/2, (radius+temp)/2);  
  }    
}         

void setup() {       
  size(w+2*p+10, h+2*p);   
  beginRecord(PDF, "output3.pdf");  

  //stroke(.5);                                                                                                                                  
  noStroke();                                                                                                                            
  background(255,255,255);                                                                                                                    
  noLoop();                                                                                                                                   
  randomSeed(millis());  
  img = loadImage("fluxama.png");  
}                                                                                                                                             

void draw() {
  for (int i=0; i<rows; i++) {  
      for (int j=0; j<cols; j++) {
        if (img.get((j*r*2),(i*r*2)) == color(255)) {
         drawCircles(0, 1, j*r*2+p, i*r*2+p, r*2);  
        }
     }  
  }
    for (int i=0; i<rows; i++) {  
      for (int j=0; j<cols; j++) {
        if (img.get((j*r*2),(i*r*2)) == color(0)) {
         drawCircles(1, repetitions, j*r*2+p, i*r*2+p, r*3);
     }  
  }
    }
  endRecord();
} 
 
Fluxamasynth | Fluxamachine