I'm having this same issue. Curious to know if anyone has found an answer.
Here is a example,
Where I stop the animation using a script.
IN the main.html i have added a button elemtn externally.
When you click on it i call a function in main.js file which stops the animaiton.
Hope this helps