Here is what I do to create animation:
(These are animations that run in a browser)
JSXGraph is developed by a small team of people at the 'Lehrstuhl für Mathematik und ihre Didaktik'. Bayreuth, Germany.
JSXGraph generates the SVG code for the view, and it automates creation of all kinds of curves, for instance splines. See the JSXGraph API reference
JSXGraph is designed to be dynamic. The position of any view element can be set up as a function of something else. Because of that dynamic nature JSXGraph readily supports animation.
I use JSXGraph because for the viewers that is the most accessible. (The animations are on my website.)
Let's say you start using glowscript. Well, what if that project is abandoned? It could be that at some point in the future you can no longer run those simulations, because there is a breaking change in the rendering platform. I looked at the descriptions of glowscript, and I decided against using it because the architecture kind of looks like a Rube Goldberg machine to me.
JSXGraph: I expect that even if JSXGraph development halts then for the from-that-moment-on-frozen-in-time library no browser incompatibility will arise ever, hence existing animations remaining functional.
Before starting to use JSXGraph I used a simulation environment called EJS.
EJS is the life's work of a spanish mathematician called Francisco Esquembre.
EJS runs on the Java Platform.
But when Oracle acquired Sun Microsystems stewardship of the Java platform went to Oracle, and Oracle pushes for business use only. So Francisco Esquembre saw his life's work evaporate, in the sense that today few consumers have Java on their system.
The way I understand your question is that your main requirement is that you need a general purpose platform. That means you need a platform that allows you to write the source code for the physics yourself, with the platform providing rendering functionality.
In my case those requirements led me to choosing JSXGraph.