For the latest version of Swiffy (Swiffy runtime version 5.2 https://www.gstatic.com/swiffy/v5.2/runtime.js ) I did this.
1. Use jsbeautifier.org as indicated in the samb post.
2. Find the function containing .start (). In my case...
db(N, function () { var a = this.Dg; this.ck(function () { a.start() }) }); db(Yj[I], Yj[I].start);
3.Disable this function with a different name and replace start () with stop ()
myNewFunction(N, function () { var a = this.Dg; this.ck(function () { a.stop() }) }); myNewFunction(Yj[I], Yj[I].stop);
4. Record the declaration of the function containing .start (). In my case, db.
function db(a, b) { return a.start = b }
5. Duplicate this function and name it the same as the new function that you created using the stop () function, and replace start with stop. In my case, myNewFunction.
function myNewFunction(a, b) { return a.stop = b }
What is it.
Now you can call my anim.stop ();
eg.
//create anim var anim = {swiffy code}; var myAnim = new swiffy.Stage(document.getElementById('animContainer'), anim); myAnim.start(); //some button click myButton.on('click',function(){ myAnim.stop(); });
r8n5n
source share