Animated gradient library (JS) that doesn’t reset after changing page

I was searching a simple JS library that could provide me an animated gradient. I found some such as Gradientify. The only problem is that if I change or reload the page, the effect reset to the original color, as it was intended. I was wondering, then, if there was a way (changing library, writing a new little script, …) to have a seamless transition, so that the color goes on from where it was on the previous page.

I hope my answer is clear. Thanks in advance to everyone.