**This is an old revision of the document!** ----
====== About the script ====== * Purpose : This script will toggle one of my animation scripts * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Current Version : 2.1 * Link: ... ====== Changelog ====== * Version 2.1 (19/5/2014): standardized for all animations ====== Compatible scripts ====== * [[script_animation_bulldoze|Scrollanimation "Bulldoze"]] * [[script_animation_flip|Scrollanimation "Flip"]] * [[script_animation_shrink|Scrollanimation "Shrink"]] * [[script_animation_zigzag|Scrollanimation "Zigzag"]] * There may be more, but these ones are proved ====== Script Code ====== <code> //config var mainScriptsName= "Animation"; //endconfig var d=LL.getEvent().getContainer(); var box=d.getBoundingBox(); var cont=JSON.parse(d.getTag()||"null"); if(cont==null) cont=new Object(); cont.minx=box.getLeft(); cont.maxx=box.getRight(); cont.miny=box.getTop(); cont.maxy=box.getBottom(); var items=d.getItems(); LL.runScript(mainScriptsName,null); var dwidth=d.getWidth(); var dheight=d.getHeight(); if(cont.setup!=true) { for(x=0;x<items.length;x++) { var i=items.getAt(x); var data=new Object(); data.posx=i.getPositionX(); data.posy=i.getPositionY(); if(i.getProperties().getBoolean("i.onGrid")) data.onGrid=true; else data.onGrid=false; i.getProperties().edit().setBoolean("i.onGrid",false).commit(); i.setTag(JSON.stringify(data)); } cont.setup=true; Android.makeNewToast("Animation enabled",true).show(); } else { var cellw=d.getCellWidth(); var cellh=d.getCellHeight(); for(x=0;x<items.length;x++) { var i=items.getAt(x); var data=JSON.parse(i.getTag()); if(data!=null && data.onGrid==true) { iwidth=i.getWidth(); iheight=i.getHeight(); i.getProperties().edit().setBoolean("i.onGrid",true).commit(); i.setCell(Math.round(data.posx/cellw),Math.round(data.posy/cellh),Math.round((data.posx+iwidth)/cellw),Math.round(( data.posy+iheight)/cellh)); } i.setScale(1,1); i.setVisibility(true); } cont.setup=false; Android.makeNewToast("Animation disabled",true).show(); } d.setTag(JSON.stringify(cont)); </code>