JavaScript Canvas transparency problem
So, I'm making a project, in which there are some moving lines and in order to create a smooth trail while the lines move I fill the whole screen with a rectangle which I give a color using rgba to add transparency, this works fine, however, this also removes the transparent background of the canvas, I wanted to make the canvas take the whole screen and that creates problems, so I was looking for a way to make that trail effect using another way, so that the pixels that are being animated are slowly becoming invisible, and I want the canvas to keep a transparent background so it can be used for the whole screen of the page, at first I thought maybe I could use clearRect and use globalAlpha to reduce it's transparency but it doesn't work, any ideas of how I could do this?