Need help moving from Flash to HTML templates

This is an example:

Those are two separate templates (plus the tag above the first one).
When the second is added, the first just fade out and won’t remove the background playing in the server. The second one then fills the mask to its new position.

The templates are pre-made (a client bought a premade Ae template pack and handed it to me to make it work in Caspar) so I can’t really change the way that it is made. I never make such static templates. Most of the time vectors and filters work just fine.