====== About the script ====== * Purpose : This script moves the items of the desktop based on Lagrange interpolation. * Author : [[https://plus.google.com/+TrianguloY|TrianguloY]] * Link: https://plus.google.com/+TrianguloY/posts/6pqgDR3nNex (with video with instructions) ====== How to use the script ====== You specify data of an item in some pages and it will move smoothly from one to another. It is made as efficient as possible. No saved data is not counted, and even with so much pages saved it should be unnoticeable. (Of course this depends on the device) To use it only set it in the position change event of the desired container. Then save the data of each item (one by one, sorry) as seen in the video. (check the link before) ====== Script code ====== var extrapolate=false;//set this to true to extrapolate //clases LL.bindClass("android.app.AlertDialog"); LL.bindClass("android.content.DialogInterface"); //vars var event=LL.getEvent(); var item=event.getItem(); var cont=event.getContainer(); var source=event.getSource(); //the list of parameters var parameters = ["Position X","Position Y","Rotation","Scale X","Scale Y","Alpha","Width","Height"]; //vars related to the interpolation data var data=JSON.parse(cont.getTag("intpol"))||{}; var d; var page; var flags=[]; if(source=="C_POSITION_CHANGED"){ //interpolate apply(); }else if(item!=null){ //apply settings for the item //create the object that will contain the data d=(data[item.getId()])||{flags:[],lagrange:[],pages:[]}; while(d.flags.lengthindex[1][n]) return d.pages[prop][index[1][n]]; if(c=0;--t){ out=index[0][t]+(c-index[1][t])*out; } if(min!=null&&outmax)return max; return out; } function difdiv(values,nodes,prop){ //fixed function: calculates the data of the interpolation polynomial based on the saved data var y=[[]]; var n=nodes.length; if(n<=0){ delete d.lagrange[prop]; d.flags[prop]=false; }else{ d.flags[prop]=true; } for(var t=0;t:{ flags:[,] //will animate or not lagrange:[property]:{ [0]: d of the polynomial [1]: nodes } pages:[property]{ [page] value of that property at the current page } } } */