There seems to be little support or discussion around regarding Google Swiffy (http://swiffy.googlelabs.com/).
Is it possible to effectively pause/resume/manipulate a swiffyobject from JS?
Using standard Google output, I noticed the swiffyobject could be found in console with a few properties; notably frameRate. Could this property be manipulated for example?
For the latest Swiffy release (Swiffy runtime version 5.2 https://www.gstatic.com/swiffy/v5.2/runtime.js) I did this.
1.Use jsbeautifier.org as mentioned in samb's 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.Duplicate 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.Find the declaration of the function containing .start(). In my case db.
function db(a, b) {
return a.start = b
}
5.Duplicate this function and call it the same as the new function you created with stop() in and replace start with stop. In my case myNewFunction.
function myNewFunction(a, b) {
return a.stop = b
}
That's it.
Now you can call my anim.stop();
e.g.
//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();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With