Wet/Sharp

The second assignment for Printing Code was to create an image that evokes the concept of “wet” in one shape, and the concept of “sharp” in another. For “sharp,” I thought jagged lines would be most effective. I wanted them to seem a little irregular to add an extra sense of foreboding. I decided that “wet” would be best conveyed with a splashy, dripping blob.

wetSharp

The code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//Kim Ash
//Printing Code
//Wet/Sharp
 
PGraphics canvas;
int canvas_width = 5100;
int canvas_height = 5100;
 
float ratioWidth = 1;
float ratioHeight = 1;
float ratio = 1;
 
void setup()
{ 
  size(800, 800);
  background(30);
 
  canvas = createGraphics(canvas_width, canvas_height, P2D);
 
  calculateResizeRatio();
 
  canvas.beginDraw();
    canvas.background(255);
    canvas.smooth();
    canvas.stroke(0);
    canvas.strokeWeight(4);
    //canvas.fill(255);
 
    //wet
    randomSeed(683);  //97
    canvas.strokeWeight(height/30);
    int circleRadius = canvas.width/5;
    float numVertices = 70;
    float vertexDegree = 360 / numVertices;
    canvas.fill(0);
    canvas.pushMatrix();
    canvas.translate(canvas.width/2, canvas.height/4);
    canvas.beginShape();
        for(int i = 0; i < numVertices; i++)
      {
        float x = cos(radians(i * vertexDegree)) * (circleRadius*2);
        float y = sin(radians(i * vertexDegree)) * (circleRadius + random(-height/4, height/4));
        if(y>=circleRadius)  {
          canvas.curveVertex(x, y + height/2);
        }
        else  {
          canvas.curveVertex(x, y);
        }
      }
    canvas.endShape(CLOSE);
    canvas.popMatrix();
 
    //sharp
    canvas.noFill();
 
    canvas.strokeCap(ROUND);
    noiseSeed(4);
    canvas.beginShape();
    for(int i=0; i<21; i++)
    {
      if(i%2 == 0) {  //even points are peaks, odds are valleys
        canvas.vertex(canvas.width - i*(canvas.width/20), (5*canvas.height/6)*noise(i*0.1));
        //canvas.vertex(canvas.width - i*(canvas.width/20), canvas.height*noise(i*0.1));
      }
      else  {
        canvas.vertex(canvas.width - i*(canvas.width/20), canvas.height*noise(i*0.1));
        //canvas.vertex(canvas.width - i*(canvas.width/20), (5*canvas.height/6)*noise(i*0.1));
      }
    }
    canvas.endShape();
  canvas.endDraw();
 
  float resizedWidth = (float) canvas.width * ratio;
  float resizedHeight = (float) canvas.height * ratio;
  //displays canvas onscreen
  image(canvas, (width / 2) - (resizedWidth / 2), (height / 2) - (resizedHeight / 2), resizedWidth, resizedHeight);
 
  canvas.save("grab.tiff");
}
 
 
/* resizing function */
void calculateResizeRatio()
{
  ratioWidth = (float) width / (float) canvas.width;
  ratioHeight = (float) height / (float) canvas.height;
 
  if(ratioWidth < ratioHeight)  ratio = ratioWidth;
  else                          ratio = ratioHeight;
}