This project utilises tau (also known as two PI) which is used to equally divide the spacing between each line segments within the circumference. How the user is able to change the stroke weight and length via their mouse cursor is due the map() functions. The radius is mapped for the width (x-axis) of the canvas while the weight is mapped for the height (y-axis). An alpha value is also added in the background() to add the "motion blur" effect.
Link to Full Codes
// Mapped Variables:
let dynamicSegments = map(mouseX, -width, width, 6, 20);
let segmentLength = abs(map(mouseX, 0, width, -100, 100));
let segmentWeight = map(mouseY, height, 0, 1, 10);
let stepAngle = TWO_PI / dynamicSegments; // Equally divide the spacing between segments within the circumference.
// Setting colours for interpolation:
let fromColour = color(179, 100, 75); // Start of range
let toColour = color(299, 100, 90); // End of range
/**
* DRAW OBJECTS:
*/
for (let i = 0; i <= dynamicSegments; i += stepAngle) {
push();
translate(width / 2, height / 2);
rotate(i);
stroke(lerpColor(fromColour, toColour, i / dynamicSegments));
strokeWeight(segmentWeight);
line(0, 0, segmentLength, segmentLength);
pop();
}