Showing loading animation before chart rendering

I’m trying to build an animation of some kind, showing the user that the chart is loading without giving the impression that the page is stuck.

I read some options available for dash apps or shiny, for example:

Has anyone tried something similar in javascript?

Thank you in advance

If anyone has a solution i would be interested too