Create N dots and each frame move every dot a fraction of the way toward its target: `dot[i].pos += (target - dot[i].pos) * k` (linear interpolation). The first dot's target is the real cursor; the second dot's target is the first dot's current position — chaining them this way accumulates delay down the line into a natural tail.
A smaller `k` (interpolation factor, usually 0.3–0.5) makes a longer, looser tail; a larger one hugs the cursor tightly. Shrinking size and opacity further down the chain sells the fading-away feel.
Past ~20 dots, updating DOM styles every frame gets expensive. In production you'd draw to a `<canvas>` instead, or just cap the count around 10.
When to use
Use it as decorative flair on canvas tools or experimental landing pages. In ordinary web apps it keeps drawing the eye to the cursor and becomes distracting.