====== About the script ======
* Purpose : This script gives you a collection of beautiful Scrollanimations
* Author : F43nd1r
* Current Version : 1.4
* Download available! (Check repository)
* Link (with video): https://plus.google.com/115366157037831519359/posts/csLe66N4FZ7
**Note: This script may not work out of the box. It is recommended to use it only within the context of the APK**
====== Code =======
LL.bindClass("android.app.AlertDialog");
LL.bindClass("android.content.DialogInterface");
LL.bindClass("android.view.View");
LL.bindClass("android.widget.ListView");
LL.bindClass("android.widget.LinearLayout");
LL.bindClass("android.widget.CheckBox");
LL.bindClass("android.widget.RadioGroup");
LL.bindClass("android.widget.RadioButton");
LL.bindClass("android.widget.SimpleAdapter");
LL.bindClass("android.widget.AdapterView");
LL.bindClass("android.widget.TextView");
LL.bindClass("android.widget.ScrollView");
LL.bindClass("android.os.Environment");
LL.bindClass("android.R");
LL.bindClass("java.util.HashMap");
LL.bindClass("java.util.ArrayList");
LL.bindClass("java.io.FileOutputStream");
LL.bindClass("java.io.ObjectOutputStream");
LL.bindClass("java.io.FileInputStream");
LL.bindClass("java.io.ObjectInputStream");
LL.bindClass("java.io.File");
LL.bindClass("java.lang.reflect.Array");
LL.bindClass("java.lang.Class");
var MY_PKG="net.pierrox.lightning_launcher.llscript.animations";
// install (or update) a script given its id in the package, and its clear name in the launcher data
function installScript(id,name){
// load the script (if any) among the existing ones
var script=LL.getScriptByName(name);
var script_text=LL.loadRawResource(MY_PKG,id);
if(script==null){
// script not found: install it
script=LL.createScript(name,script_text,0);
}else{
// the script already exists: update its text
script.setText(script_text);
}
return script;
}
var title="Install Animations";
var animations=new HashMap();
animations.put("Bulldoze","FREE");
animations.put("CardStyle","ONE");
animations.put("Flip","BOTH");
animations.put("In and Out","BOTH");
animations.put("Shrink","BOTH");
animations.put("Turn","ONE");
animations.put("ZigZag","ONE");
var items=[];
var it=animations.keySet().iterator();
while(it.hasNext())
{
items.push(it.next());
}
items.sort();
var checked=[];
for(var a=0;a
LL.bindClass("java.util.HashMap");
LL.bindClass("java.io.FileOutputStream");
LL.bindClass("java.io.ObjectOutputStream");
LL.bindClass("java.io.FileInputStream");
LL.bindClass("java.io.ObjectInputStream");
LL.bindClass("java.io.File");
LL.bindClass("android.os.Environment");
LL.bindClass("java.lang.IllegalArgumentException");
function setupPages()
{
var items=c.getItems();
cont.put("pages",new HashMap());
cont.put("all",[]);
for(var x=0;x5||Math.abs(item.getPositionY()-page[z][8])>5)
{
var posX=item.getPositionX();
var posY=item.getPositionY();
var rot=item.getRotation();
var scaleX=item.getScaleX();
var scaleY=item.getScaleY();
var onGrid=page[z][6];
var newX=Math.floor(posX/dWidth);
var newY=Math.floor(posY/dHeight);
var newPage=asOne(newX,newY);
if(newPage!=asOne(x,y))
{
page.splice(z,1);
if(cont.get("pages").get(newPage)==null)cont.get("pages").put(newPage,[]);
cont.get("pages").get(newPage).push([item.getId(),posX,posY,rot,scaleX,scaleY,onGrid,posX,posY]);
loadBorders();
saveToFile();
return false;
}
else
{
page[z]=[item.getId(),posX,posY,rot,scaleX,scaleY,onGrid,posX,posY];
}
}
return true;
}
function loadNewItems()
{
for(var x=0;xcont.get("all").length)
{
loadNewItems();
}
if(percent>0.005&&percent<99.995&&dPosX>cont.get("minX")-dWidth&&dPosY>cont.get("minY")-dHeight)
{
jumped=false;
var scrollLimit=cont.get("pageLoop");
if(dPosX>cont.get("maxX")-dWidth&&scrollLimit)
{
dPosX=cont.get("minX")-(dWidth*0.99);
c.setPosition(dPosX,dPosY,1,false);
jumped=true;
return;
}
else if(dPosY>cont.get("maxY")-dHeight&&scrollLimit)
{
dPosY=cont.get("minY")-(dHeight*0.99);
c.setPosition(dPosX,dPosY,1,false);
jumped=true;
return;
}
if(dPosX=0;z--)
{
var data=cont.get("pages").get(page)[z];
var item=LL.getItemById(data[0]);
if(!checkItem(x,y,z))
{
continue;
z--;
}
item.setRotation(data[3]);
item.setScale(data[4],data[5]);
item.setPosition(data[1],data[2]);
cont.get("pages").get(page)[z][7]=data[1];
cont.get("pages").get(page)[z][8]=data[2];
item.getProperties().edit().setInteger("i.alpha",255).commit();
item.setVisibility(true);
}
}
var sel=randInt(cont.get("animations").length);
cont.put("animation",cont.get("animations")[sel]);
saveToFile();
}
function inAndOut()
{
if(percentX==percent)
{
var x=(cont.get("stateX")?maxPageX:currentX);
var y=(cont.get("stateY")?maxPageY:currentY);
var page=asOne(x,y);
var items0=cont.get("pages").get(page);
if(items0!=null)
{
for(var z=0;z0.005?percentX:1)*data[4],(1-percentY)*data[5]);
item.setPosition(dPosX+dWidth-(dWidth-(data[1]%dWidth+dWidth)%dWidth)*percentX,dPosY+((data[2]%dHeight+dHeight)%dHeight)*(1-percentY));
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
var x=(cont.get("stateX")?maxPageX:currentX);
var y=currentY+1;
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(var z=0;z0.005?percentY:1)*data[5]);
item.setPosition(dPosX+((data[1]%dWidth+dWidth)%dWidth)*(1-percentX),dPosY+dHeight-(dHeight-(data[2]%dHeight+dHeight)%dHeight)*percentY);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
var x=currentX+1;
var y=currentY+1;
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(var z=0;z0.005?percentX:1)*data[4],(percentY>0.005?percentY:1)*data[5]);
item.setPosition(dPosX+dWidth-(dWidth-(data[1]%dWidth+dWidth)%dWidth)*percentX,dPosY+dHeight-(dHeight-(data[2]%dHeight+dHeight)%dHeight)*percentY);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
}
function cardStyle()
{
var zOrder=cont.get("all").length;
var x=(cont.get("stateX")?maxPageX:currentX);
var y=minPageY;
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(var z=0;z=zOrder)c.setItemZIndex(data[0],0);
item.setScale((0.75+percentX/4)*data[4],(0.75+percentX/4)*data[5]);
item.setPosition(dPosX+dWidth/2-(dWidth/2-(data[1]%dWidth+dWidth)%dWidth)*(0.75+percent/4),dPosY+dHeight/2-(dHeight/2-(data[2]%dHeight+dHeight)%dHeight)*(0.75+percent/4));
item.getProperties().edit().setInteger("i.alpha",255*percentX).commit();
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
}
function flip()
{
var x=(cont.get("stateX")?maxPageX:currentX);
var y=(cont.get("stateY")?maxPageY:currentY);
var page=asOne(x,y);
var items0=cont.get("pages").get(page);
if(items0!=null)
{
for(z=0;z=0.5||percentY>=0.5)?1:1-percentX*2)*data[4],((percentX>=0.5||percentY>=0.5)?1:1-percentY*2)*data[5]);
item.setPosition(dPosX+((data[1]%dWidth+dWidth)%dWidth)+percentX*(dWidth-((data[1]%dWidth+dWidth)%dWidth)*2),dPosY+((data[2]%dHeight+dHeight)%dHeight)+percentY*(dHeight-((data[2]%dHeight+dHeight)%dHeight)*2));
item.setVisibility(percentX<0.5 && percentY<0.5);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
var x=currentX+1;
var y=(cont.get("stateY")?maxPageY:currentY);
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(z=0;z=0.5?1:percentX*2-1)*data[4],(percentX<0.5||percentY>=0.5?1:1-percentY*2)*data[5]);
item.setPosition(dPosX+dWidth/2*(2-percentX*2)+((data[1]%dWidth+dWidth)%dWidth)*(percentX*2-1),dPosY+((data[2]%dHeight+dHeight)%dHeight)+percentY*(dHeight-((data[2]%dHeight+dHeight)%dHeight)*2));
item.setVisibility(percentX>=0.5 && percentY<0.5);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
var x=(cont.get("stateX")?maxPageX:currentX);
var y=currentY+1;
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(z=0;z=0.5||percentY<0.5?1:1-percentX*2)*data[4],(percentX>=0.5||percentY<0.5?1:percentY*2-1)*data[5]);
item.setPosition(dPosX+((data[1]%dWidth+dWidth)%dWidth)+percentX*(dWidth-((data[1]%dWidth+dWidth)%dWidth)*2),dPosY+dHeight/2*(2-percentY*2)+((data[2]%dHeight+dHeight)%dHeight)*(percentY*2-1));
item.setVisibility(percentX<0.5 && percentY>=0.5);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
}
function shrink()
{
var x=(cont.get("stateX")?maxPageX:currentX);
var y=(cont.get("stateY")?maxPageY:currentY);
var page=asOne(x,y);
var items0=cont.get("pages").get(page);
if(items0!=null)
{
for(z=0;z=0.5?1:1-percent*2)*data[4],(percent>=0.5?1:1-percent*2)*data[5]);
item.setPosition(dPosX+((data[1]%dWidth+dWidth)%dWidth)+percent*(dWidth-((data[1]%dWidth+dWidth)%dWidth)*2),dPosY+((data[2]%dHeight+dHeight)%dHeight)+percent*(dHeight-((data[2]%dHeight+dHeight)%dHeight)*2));
item.setVisibility(percent<0.5);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
if(percentX==percent)
{
var x=currentX+1;
var y=(cont.get("stateY")?maxPageY:currentY);
}
else
{
var x=(cont.get("stateX")?maxPageX:currentX);
var y=currentY+1;
}
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(z=0;z=0.5);
cont.get("pages").get(page)[z][7]=item.getPositionX();
cont.get("pages").get(page)[z][8]=item.getPositionY();
}
}
}
function turn()
{
var x=(cont.get("stateX")?maxPageX:currentX);
var y=minPageY;
var page=asOne(x,y);
var items=cont.get("pages").get(page);
if(items!=null)
{
for(z=0;z
====== Old Versions: Single Animation as Script ======
* [[script_animation_bulldoze|"Bulldoze"]]
* [[script_animation_cardstyle|"Cardstyle"]]
* [[script_animation_flip|"Flip"]]
* [[script_animation_inAndOut|"In and out"]]
* [[script_animation_shrink|"Shrink"]]
* [[script_animation_turn|"Turn"]]
* [[script_animation_zigzag|"Zigzag"]]