User Tools

Site Tools


script_animation_zigzag

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== About the script ====== * Purpose : These scripts will give you a beautiful page transition animation and an optional horizontal page loop * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Idea : TrianguloY * Current Version : 1.0 * Link: ... ====== Changelog ====== * Version 1.0 (19/5/2014): initial release in wiki ====== How to use the script ====== * Set the main script to the positionchanged event of your container; configure the main script, if you want another bounciness * 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 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>//config var bounciness=0.5;//from 0 (normal) to 1 (bounce complete to top) //endconfig 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 current=Math.floor(dposx/dwidth); var pagepos=current*dwidth; var percent=(dposx-pagepos)/dwidth; var items=d.getItems(); var l=items.getLength(); var maxpage=Math.floor( (cont.maxx-dwidth)/dwidth); if((percent>0.005 && percent<99.995) && dposx>cont.minx-dwidth) { var scrollLimit=d.getProperties() .getBoolean("noScrollLimit"); if(dposx>cont.maxx-dwidth&&scrollLimit){ d.setPosition(cont.minx-dwidth,dposy,1,false); } if(dposx<cont.minx&&scrollLimit) cont.state=true; for(i=0;i<l;i++) { item=items.getAt(i); var pinned=item.getProperties() .getString("i.pinMode"); var data=JSON.parse(item.getTag()); if(pinned=="NONE"|| pinned=="Y") { if(Math.floor(data.posx/dwidth)==current||(cont.state && Math.floor(data.posx/dwidth)==maxpage)) { item.setPosition(pagepos+((data.posx%dwidth+dwidth)%dwidth),data.posy-percent*dheight*bounciness); } if(Math.floor(data.posx/dwidth) ==current+1) { item.setPosition(data.posx,data.posy-dheight*(1-percent)*bounciness); } } } } else { d.setPosition(dposx,dposy); d.setPosition(dposx<cont.minx?cont.maxx-dwidth:dposx,dposy,1,false); cont.state=false; for(i=0;i<l;i++) { item=items.getAt(i); var data=JSON.parse(item.getTag()); item.setPosition(data.posx,data.posy); } } </code> ====== Toggle Script ====== <code> </code>

script_animation_zigzag.1400486346.txt.gz · Last modified: 2014/05/19 07:59 by lm13