Processing day 4: A line with some weight to it

[processing width=”480″ height=”120″ file=”http://www.ashleyelsdon.com/wp-content/uploads/2012/03/A_line_with_weight.jar” method=”inline”]Load the applet[/processing]

Here we are again, another little bit of processing. This little sketch still draws a line again but adds some weight to it. Have a go, and here’s the code too.

void setup() {
size(480, 120);
smooth();
stroke(0, 120);
}

void draw() {
float weight = dist(mouseX, mouseY, pmouseX, pmouseY);
strokeWeight(weight);
line(mouseX, mouseY, pmouseX, pmouseY);
}