class Web { final static int JITTER = 10; ArrayList points; Vector strands; public Web() { points = new ArrayList(); } public boolean add(float x, float y) { x += random(-JITTER, JITTER); y += random(-JITTER, JITTER); float[] p = {x, y}; return points.add(p); } public void drawMe() { stroke(#666666); drawStrands(); for (int i = 1; i < points.size(); i++) { float[] a = (float[]) points.get(i - 1); float[] b = (float[]) points.get(i); line(a[0], a[1], b[0], b[1]); } } void drawStrands() { int x = width / 2; int y = height / 2 - width; for (int i = 0; i < 12; i++) { line(width / 2, height / 2, x, y); float theta = PI / 12 * (2 * i + 1); x += 2 * width * cos(Spider.ANGLE_CONSTANT) * cos(theta); y += 2 * width * cos(Spider.ANGLE_CONSTANT) * sin(theta); } } void reset() { points.clear(); } }