Leaving a trail when dragging along a path

Can anyone tell me if thee is a command for leaving a coloured trail or line when dragging along a path?

This example draws a black line with a pen:

Here is a more exciting line:

Both are quite old, so watch for animation time in ms versus seconds, etc.