Manipulate javascript animation exported from svgator

966 Views Asked by At

I noticed that there is no programmatic way to manipulate an SVG animation that was exported from SVGator. The official docs explain how you can start it by a click. But there is no way to stop it.

2

There are 2 best solutions below

0
Kirill Kulakov On

I was able to find a workaround. You can replace the following code in the svg file

i=new t(n.animations,n.options);

with

i=new t(n.animations,n.options); if (!document.__SVGATOR_) document.__SVGATOR__ = {}; document.__SVGATOR__[n.root] = i;

then you will be able to stop the animation by doing

document.__SVGATOR__['id-of-dom-element'].stop()

0
Looky On

You do have the option to export with a "pause" on every second click.

example