Learning Processing Day 0002

Today's Meisterstück is another early exercise in Daniel Shiffman's monumental Learning Processing book.




Using the absolute value of the current mouse position in X, minus the previous mouse position in X, we can calculate the speed of the cursor, and feed that data into the line width, thusly:

void setup() {
size(500, 500);
background(100, 200, 100);
smooth();
}

void draw() {
stroke(0);
strokeWeight(abs(mouseX-pmouseX));
line(pmouseX, pmouseY, mouseX, mouseY);
}


I will take it as read that all who gaze upon the intriguing abstract piece I made with this tool will agree that it is certainly a Meisterstück.


Vote Dan Shiffman for World Teacher!


(Meisterstück aside though, as an aside, man do I feel lucky that by accident of history, English became the lingua franca of programming languages; imagine if it had been German.)