User Tools

Site Tools


script_sidebar_anim

====== About the script ====== * Purpose : Animate panels to look like the Reddit app menu animation * Author : [[http://www.google.com/+BogdanTautuTBog|TBog]] * Link: [[https://plus.google.com/113849548683946155652/posts/b7kH4ryEkvH|requested post]] ====== How to use the script ====== This is how the panels should look (vertical position and height are not important). [[https://lh5.googleusercontent.com/-vouYHHAtZhs/UzwNHyUvpHI/AAAAAAAARSk/2MWUSg_ANOA/w1078-h854-no/2014-04-02+15.32.00.png|Screen]] * Left and right panels must not be on grid but must have the width of the screen minus one cell * Center panel must be on top and have a opaque background to hide the other two panels * Stop points should have the following options set: - left stop point * Behavior: Barrier, Snapping * Direction: Left to right, Right to left * Match edges: Left - center stop point * Behavior: Stop scroll, Stop drag, Snapping * Direction: Left to right, Right to left * Match edges: Left - right stop point * Behavior: Barrier, Snapping * Direction: Left to right, Right to left * Match edges: Left * Set the script on the Position changed event of the desktop **Important!** Replace 0x40004 and 0x40005 from the script with the ids of your panels. ====== Script code ====== <code> var c = LL.getCurrentDesktop(); var cell = c.getCellWidth(); /* left panel */ var pLeft = c.getItemById(0x40005); /* right panel */ var pRight = c.getItemById(0x40004); /* i assume that one cell of the main desktop page will still be visible after stop point reached */ var w = c.getWidth(); var ww = w-cell; var x = c.getPositionX()/ww; ww = ww/2; if (x <= 0) pLeft.setPosition(-ww + x*ww, pLeft.getPositionY()); if (x >= 0) pRight.setPosition(cell + ww + x*ww, pRight.getPositionY()); </code>

script_sidebar_anim.txt · Last modified: 2014/05/03 20:33 by tbog