User Tools

Site Tools


script_toggle_animation

====== About the script ====== * Purpose : This script will toggle one of my animation scripts * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Current Version : 2.2 * Link: ... * **//Deprecated//** ====== Changelog ====== * Version 2.1 (19/5/2014): standardized for all animations * Version 2.2 (26/6/2014): added rotation ====== Compatible scripts ====== * [[script_animation_bulldoze|Scrollanimation "Bulldoze"]] (below Version 3) * [[script_animation_flip|Scrollanimation "Flip"]] (below Version 3) * [[script_animation_shrink|Scrollanimation "Shrink"]] (only Version 1) * [[script_animation_zigzag|Scrollanimation "Zigzag"]] (only Version 1) * [[script_animation_inAndOut|Scrollanimation "In and out"]] (only Version 1) * [[script_animation_turn|Scrollanimation "Turn"]] (only Version 1) * <del>There may be more, but these ones are proved</del> this Script is at EOL ====== Script Code ====== <sxh javascript;>//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(); data.rot=i.getRotation(); 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()); i.setScale(1,1); i.setVisibility(true); i.setRotation(data.rot); 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)); } } cont.setup=false; Android.makeNewToast("Animation disabled",true).show(); } d.setTag(JSON.stringify(cont)); </sxh>

script_toggle_animation.txt · Last modified: 2014/07/24 16:17 by lm13