Wednesday, July 29, 2015

skulls!

I finally got print copies made of my comic on coping with mortality So You're Going to Die:




After the PDF drafts came back, I realized the blank sheets for the inside covers were kind of bland, so I made up a processing program to make a nice skull-themed pattern for some faux endpapers:


The thing scales completely, just by changing the initial width and height. (Plus my artist complimented my choice of colors)

Here's the code- a little hackish in terms of the loops etc but like someone said "the nice thing about making static computer graphics is, if it looks right, it's right":

color tan =#d1b48c; 
color pale = color(255, 255, 180);

int beat = 6;

float sz;
void setup() {
  strokeCap(SQUARE);
  size(500, 500);
  sz = width / 30;
}

void draw() {
  background(tan);
  stroke(pale);
  fill(pale);
  strokeWeight(width/100 * .4);

  for (int i = -beat*4; i < beat*4; i++) {
    line(i * (width / beat), -height, i * (width / beat) +( width*3), height*2);   
    line(i * (width / beat), -height, i * (width / beat) -( width*3), height*2);
  }


  noStroke();
  for (int x = 0; x < 10; x++) {
    for (int y = 0; y < 10; y++) {
      drawSkull(width/beat * x, width/beat * y);
      drawSkull(width/beat *( x+.5), width/beat *( y+.5));
    }
  }
}
void drawSkull(float x, float y) {
  noStroke();
  pushMatrix();
  translate(x, y - sz*.2);
  ellipse(0, 0, sz, sz);
  fill(pale);
  drawEye(-1);
  drawEye(1);
  drawNose();
  drawJaw();
  popMatrix();
}

void drawEye(float mul) {
  pushMatrix();
  fill(tan);
  translate(mul * sz * .2, -sz*.1);
  ellipse(0, 0, sz*.25, sz*.4);
  popMatrix();
}

void drawNose() {
  pushMatrix();
  fill(tan);
  translate(0, sz*.1);
  drawNostril(-1);
  drawNostril(1);
  popMatrix();
}

void drawNostril(float mul) {
  pushMatrix(); 
  translate(mul * sz*.125, sz*0);
  rotate(1.2*mul);
  ellipse(0, sz*.1, sz*.25, sz*.125);
  popMatrix();
}

void drawJaw() {
  fill(pale, 255);
  float xs = .9;//map(mouseX,0,width,0,2);
  float ys = .3;//map(mouseY,0,height,0,2);
  translate(0, sz*ys);
  float z = xs * sz*.9;
  rect(-z/2, 0, z, sz*.3); 
  stroke(tan);
  strokeWeight(sz*.08);
  drawJawLine(0);
  drawJawLine(-sz*.225);
  drawJawLine(sz*.225);
}
void drawJawLine(float x) {
  line(x, 0, x, sz*.3);
}


No comments:

Post a Comment