**This is an old revision of the document!** ----
====== About the script ====== * Purpose : These scripts will give you a beautiful page transition animation and an optional horizontal & vertical page loop * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Current Version : 1.0 * Link (with Video) : https://plus.google.com/115366157037831519359/posts/NLnDw9QbC9a ====== Changelog ====== * Version 1.0 (24/5/2014): initial release in wiki ====== How to use the script ====== * Set the main script to the positionchanged event of your container * enable infinte scrolling if you want a page loop, disable it if you don't want to loop through pages * in this container: create a shortcut to the [[script_toggle_animation|Toggle Script]] and set up toggle sripts configuration * one click on the shortcut will enable the animation, clicking again will disable the animation. * BE SURE TO DISABLE THE ANIMATION BEFORE YOU EDIT, MOVE OR ADD ITEMS! //please report all bugs in the g+ community!// ====== Main Script ====== <code>var d=LL.getEvent().getContainer(); var cont= JSON.parse(d.getTag()||"null"); if(cont==null || !cont.setup || d.getPositionScale()!=1)return; var dwidth=d.getWidth(); var dheight=d.getHeight(); var dposx=d.getPositionX(); var dposy=d.getPositionY(); var currentx=Math.floor(dposx/dwidth); var pageposx=currentx*dwidth; var percentx=(dposx-pageposx)/dwidth; var currenty=Math.floor(dposy/dheight); var pageposy=currenty*dheight; var percenty=(dposy-pageposy)/dheight; var items=d.getItems(); var l=items.getLength(); var maxpagex=Math.floor( (cont.maxx-dwidth)/dwidth); var maxpagey=Math.floor( (cont.maxy-dheight)/dheight); var percent; if(Math.abs(0.5-percentx)<Math.abs(0.5-percenty)) percent=percentx; else percent=percenty; if(((percentx>0.005 && percentx<99.995)|| (percenty>0.005 && percenty<99.995) )&& dposx>cont.minx-dwidth && dposy>cont.miny-dheight) { var scrollLimit=d.getProperties() .getBoolean("noScrollLimit"); if(dposx>cont.maxx-dwidth&&scrollLimit){ d.setPosition(cont.minx-dwidth,dposy,1,false); } else if(dposy>cont.maxy-dheight&&scrollLimit) d.setPosition(dposx,cont.miny-dheight,1,false); if(dposx<cont.minx&&scrollLimit) cont.statex=true; if(dposy<cont.miny&&scrollLimit) cont.statey=true; for(i=0;i<l;i++) { item=items.getAt(i); var pinned=item.getProperties() .getString("i.pinMode"); var data=JSON.parse(item.getTag()); var newposx=data.posx; var newposy=data.posy; var newscalex=1; var newscaley=1; var newvis=true; if((pinned=="NONE"|| pinned=="Y")&&percentx==percent) { if(Math.floor(data.posx/dwidth)==currentx || (cont.statex && Math.floor(data.posx/dwidth)==maxpagex)) { newscalex=1-percent*0.75; newposx=pageposx+((data.posx%dwidth+dwidth)%dwidth)+(dwidth-((data.posx%dwidth+dwidth)%dwidth))*(1-newscalex); if(Math.floor(data.posy/dheight)==currenty){ newscaley=1-percent*0.75; newposy=data.posy+(dheight-((data.posy%dheight+dheight)%dheight)*2)*(1-newscaley)/2; } } if(Math.floor(data.posx/dwidth) ==currentx+1) { newscalex=percent*0.75+0.25; newposx=pageposx+dwidth+((data.posx%dwidth+dwidth)%dwidth)*newscalex; if(Math.floor(data.posy/dheight)==currenty){ newscaley=percent*0.75+0.25; newposy=data.posy+(dheight-((data.posy%dheight+dheight)%dheight)*2)*(1-newscaley)/2; } } } if((pinned=="NONE"|| pinned=="X")&&percenty==percent) { if(Math.floor(data.posy/dheight)==currenty||(cont.statey && Math.floor(data.posy/dheight)==maxpagey)) { newscaley=1-percent*0.75; newposy=pageposy+((data.posy%dheight+dheight)%dheight)+(dheight-((data.posy%dheight+dheight)%dheight))*(1-newscaley); if(Math.floor(data.posx/dwidth)==currentx){ newscalex=1-percent*0.75; newposx=data.posx+(dwidth-((data.posx%dwidth+dwidth)%dwidth)*2)*(1-newscalex)/2; } } if(Math.floor(data.posy/dheight) ==currenty+1) { newscaley=percent*0.75+0.25; newposy=pageposy+dheight+((data.posy%dheight+dheight)%dheight)*newscaley; if(Math.floor(data.posx/dwidth)==currentx){ newscalex=percent*0.75+0.25; newposx=data.posx+(dwidth-((data.posx%dwidth+dwidth)%dwidth)*2)*(1-newscalex)/2; } } } item.setScale(newscalex,newscaley); item.setPosition(newposx,newposy); } } else { d.setPosition(dposx,dposy); d.setPosition(dposx<cont.minx?cont.maxx-dwidth:dposx,dposy<cont.miny?cont.maxy-dheight:dposy,1,false); cont.statex=false; cont.statey=false; for(i=0;i<l;i++) { item=items.getAt(i); var data=JSON.parse(item.getTag()); item.setScale(1,1); item.setPosition(data.posx,data.posy); item.setVisibility(true); } } </code>