User Tools

Site Tools


script_toggle_animation

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
script_toggle_animation [2014/06/26 15:56]
lm13
script_toggle_animation [2014/07/24 16:17] (current)
lm13 [Compatible scripts]
Line 4: Line 4:
   * Current Version : 2.2   * Current Version : 2.2
   * Link: ...   * Link: ...
 +  * **//​Deprecated//​**
  
 ====== Changelog ====== ====== Changelog ======
Line 11: Line 12:
  
 ====== Compatible scripts ====== ====== Compatible scripts ======
-  * [[script_animation_bulldoze|Scrollanimation "​Bulldoze"​]] +  * [[script_animation_bulldoze|Scrollanimation "​Bulldoze"​]] ​(below Version 3) 
-  * [[script_animation_flip|Scrollanimation "​Flip"​]] +  * [[script_animation_flip|Scrollanimation "​Flip"​]] ​(below Version 3) 
-  * [[script_animation_shrink|Scrollanimation "​Shrink"​]] +  * [[script_animation_shrink|Scrollanimation "​Shrink"​]] ​(only Version 1) 
-  * [[script_animation_zigzag|Scrollanimation "​Zigzag"​]]  +  * [[script_animation_zigzag|Scrollanimation "​Zigzag"​]] ​(only Version 1) 
-  * [[script_animation_inAndOut|Scrollanimation "In and out"​]] +  * [[script_animation_inAndOut|Scrollanimation "In and out"​]] ​(only Version 1) 
-  * There may be more, but these ones are proved ​+  * [[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 ====== ====== Script Code ======
-<code>//​config ​+<sxh javascript;>//​config ​
 var mainScriptsName= "​Animation";​ var mainScriptsName= "​Animation";​
  //​endconfig ​  //​endconfig ​
-var d=LL.getEvent().getContainer();​ var box=d.getBoundingBox();​+var d=LL.getEvent().getContainer();​ 
 +var box=d.getBoundingBox();​
 var cont=JSON.parse(d.getTag()||"​null"​); ​ 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();​  +if(cont==null) cont=new Object(); 
-var items=d.getItems();​ LL.runScript(mainScriptsName,​null); ​+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 dwidth=d.getWidth(); ​
-var dheight=d.getHeight();​ if(cont.setup!=true) ​+var dheight=d.getHeight(); ​ 
 +if(cont.setup!=true) ​
  
 for(x=0;​x<​items.length;​x++) ​ for(x=0;​x<​items.length;​x++) ​
  
 var i=items.getAt(x); ​ var i=items.getAt(x); ​
-var data=new Object(); data.posx=i.getPositionX();​ data.posy=i.getPositionY();​ +var data=new Object(); ​ 
-data.rot=i.getRotation();​ if(i.getProperties().getBoolean("​i.onGrid"​)) data.onGrid=true;​  +data.posx=i.getPositionX(); ​ 
-else data.onGrid=false;​ i.getProperties().edit().setBoolean("​i.onGrid",​false).commit();​ i.setTag(JSON.stringify(data)); ​+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();​+cont.setup=true; ​ 
 +Android.makeNewToast("​Animation enabled",​true).show();​
  
 else else
  
 var cellw=d.getCellWidth(); ​ var cellw=d.getCellWidth(); ​
-var cellh=d.getCellHeight();​ for(x=0;​x<​items.length;​x++) ​+var cellh=d.getCellHeight(); ​ 
 +for(x=0;​x<​items.length;​x++) ​
  
 var i=items.getAt(x); ​ var i=items.getAt(x); ​
Line 51: Line 67:
 if(data!=null&&​ data.onGrid==true) ​ 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)); ​+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(); ​+cont.setup=false; ​ 
 +Android.makeNewToast("​Animation disabled",​true).show(); ​
  
 d.setTag(JSON.stringify(cont));​ d.setTag(JSON.stringify(cont));​
-</code>+</sxh>
script_toggle_animation.1403798202.txt.gz · Last modified: 2014/06/26 15:56 by lm13