Weight Line
contributed by
Prof WM Harris, using the random function with events to color/weight a line
How to use the random function with events to color/ weight a line
dependent on mouse location, left mouse button clicks, character key types, and
random key releases.
Functions are created for both the canvas set up as well as the creation of
the line. Depending on the action taken by the user the line can
vary in width and color. Left mouse button clicks result in a color
change to blue, while the typing of any character key will change
the color to turquoise, each resulting in a variable stroke weight;
the width of the former will be between 0 – 1 while the width of
the latter will be 0 – 5. The release of any key will result in a
random hue, saturation, and brightness change to the line.