How to correctly display animated images of significant sizes on a website

I am developing a website where I need to display quite large images (around 1 MB each) as part of a parallax effect. Additionally, I want to use many significantly smaller images as particle effects, utilizing both and . While is a bit more challenging to implement, it offers better performance.

What is the most effective way to implement a significant number of images manipulated by code (e.g., parallax effects or changing positions relative to the mouse cursor)? Are there any libraries specifically suited to handle this issue?