Hi Muhammad!
I don’t know much about the actual implementation in code, but it might be worthwile to check out how we put an animation in our header at: https://www.elnino.tech/
I think you might be able to set something like that as a background too?
On this page: https://www.elnino.tech/over-ons you can see how we have a lot of animations on a single page. For every animation we just use the json, which we load in our html website.
Hope this helps!