Zoom scrolling

Zoom scrolling

(Updated from the old alpha version)

This script will place the items in an infinite looping row, so the camera movement is as smooth as possible. The items won’t overlap, you can click them.

Instructions:

– copy paste this script and set it at the position change event of a container (it will use all the items inside, so better a panel)

– the items will need to be not pinned and detached from the grid.

– Set the scrolling to free scroll.

It automatically adapts if a new item is added or removed. However you will need to scroll one loop to update.

Settings: change them as you want

– maxsize: the maximum size the items will have

– see: the number of items you will be able to see at once

———————————————-

/*Config */

var see = 5;// Distance between items

var maxsize = 3; //Max scale of the item

var desk = LL.getEvent().getContainer();

var v = desk.getHeight()/2;

var h = desk.getWidth()/2;

var pos = desk.getPositionX();

var items = desk.getItems();

var n = items.getLength();

var distance = 2*h/see;

for(var i=0;i

var p = Math.floor(pos/distance-n/2 +1);

var arg = (p+i)%n;

while(arg<0)arg+=n;

var item = items.getAt(arg);

var size = pos-(p+i)*distance ;

if(size<0)size=-size;

size=maxsize-( size /h*maxsize );

if(size<0.1){

size =0.1;

item.setPosition( h+(p+i)*distance ,v);

item.setSize(distance/maxsize,desk.getHeight()/maxsize);

}

item.setScale(size,size);

/*items.getAt(arg).setLabel(items.getAt(arg).getWidth() ); */

}

]]>

32 Commentsto Zoom scrolling

  1. Anonymous says:

    < ![CDATA[

    I think the out-commented line isn’t needed 😀 seems to be debug-code, and it is formatted fat because of the stars

    ]]>

  2. Anonymous says:

    < ![CDATA[

    You are totally right 😉 but I prefer to leave it there….oh no! I tried to avoid the Google format…arg.


    Thanks

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Really Google…Really? ;_;

    ]]>

  4. Anonymous says:

    < ![CDATA[

    TrianguloY change it to a //comment

    ]]>

  5. Anonymous says:

    < ![CDATA[

    Google format isn’t best. I prefer html-tags or BB-code…



    Now that I’ve seen the video: it looks amazing! I just need a place where I can use it in my screen…

    ]]>

  6. Anonymous says:

    < ![CDATA[

    Ren Shore thanks, but I prefer to keep the */ (it was a script I made in the alpha….well, I want to keep it even thought it is updated)



    [It is shown good now, right? …Right? ]

    ]]>

  7. Anonymous says:

    < ![CDATA[

    TrianguloY yes it is.

    ]]>

  8. Anonymous says:

    < ![CDATA[

    how did you get it to show right?

    ]]>

  9. Anonymous says:

    < ![CDATA[

    With spaces/line breaks you can interrupt the format (sometimes)

    ]]>

  10. Anonymous says:

    < ![CDATA[

    The trick is to put the ‘*’ once at the right, once at the left



    /*blablablabla */


    or


    /* blablablablabla*/

    ]]>

  11. Anonymous says:

    < ![CDATA[

    TrianguloY have you ever seen the effect of adding Z-order to it?

    ]]>

  12. Anonymous says:

    < ![CDATA[

    The items will change the order of appearance…if I’m not wrong

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Yep, that is what I thought. It seems to brake the complete effect however.

    ]]>

  14. Anonymous says:

    < ![CDATA[

    Jappie Toutenhoofd not exactly. Yes, they seem wrong, but it is because the items are placed only when they are small, to avoid overcomputing.


    Just do a loop and they will reorder itself.

    ]]>

  15. Anonymous says:

    < ![CDATA[

    Fabrice Fournier yes it is. Check ‘no scroll limit’ in scroll settings. Otherwise you won’t be able to scroll more.

    ]]>

  16. Anonymous says:

    < ![CDATA[

    Thks yes now it works 😀 very nice!

    ]]>

  17. Anonymous says:

    < ![CDATA[

    How can I copy the script TrianguloY . I can’t seem to copy it from here. Is there a link.

    ]]>

  18. Anonymous says:

    < ![CDATA[

    I thought it was…but no.


    Anyway you can just copy this (click, copy)





    /*Config */


    var see = 5;// Distance between items


    var maxsize = 3; //Max scale of the item






    var desk = LL.getEvent().getContainer();


    var v = desk.getHeight()/2;


    var h = desk.getWidth()/2;


    var pos = desk.getPositionX();



    var items = desk.getItems();



    var n = items.getLength();



    var distance = 2*h/see;



    for(var i=0;i


    var p = Math.floor(pos/distance-n/2 +1);


    var arg = (p+i)%n;


    while(arg<0)arg+=n;



    var item = items.getAt(arg);



    var size = pos-(p+i)*distance ;


    if(size<0)size=-size;


    size=maxsize-( size /h*maxsize );


    if(size<0.1){


    size =0.1;


    item.setPosition( h+(p+i)*distance ,v);


    item.setSize(distance/maxsize,desk.getHeight()/maxsize);


    }



    item.setScale(size,size);



    /*items.getAt(arg).setLabel(items.getAt(arg).getWidth() ); */



    }

    ]]>

  19. Anonymous says:

    < ![CDATA[

    TrianguloY hi there I’ve been looking at your scripts and I seem to like this one a lot


    🙂


    Does it still work with the current version of llx?

    ]]>

  20. Anonymous says:

    < ![CDATA[

    You can try 🙂


    This night I’ll test myself


    And thanks

    ]]>

  21. Anonymous says:

    < ![CDATA[

    OK 🙂


    Will do and thanks

    ]]>

  22. Anonymous says:

    < ![CDATA[

    Khaleel McGeachy try this instead. There are some strange things regarding the position:




    /*Config */


    var see = 5;// items you will see


    var maxsize = 2; //Max scale of the item






    var desk = LL.getEvent().getContainer();


    var v = desk.getHeight()/2;


    var h = desk.getWidth()/2;


    var pos = desk.getPositionX();


    if(h==0)return;


    var items = desk.getItems();



    var n = items.getLength()



    var distance = 2*h/see;



    for(var i=0;i


    var p = Math.floor(pos/distance-n/2 +1);


    var arg = (p+i)%n;


    while(arg<0)arg+=n;


    var item;


    try{


    item = items.getAt(arg);


    }catch(e){alert(“Error: arg=”+arg+” p=”+p+” pos=”+pos+” distance=”+distance+” h=”+h);return;}


    var size = pos-(p+i)*distance ;


    if(size<0)size=-size;


    size=maxsize-( size /h*maxsize );


    if(size<0.1){


    size =0.1;


    }




    item.setSize(distance/maxsize,2*v);



    item.setScale(size,size);





    item.setPosition( h+(p+i) *distance -distance/maxsize/2*size ,v-v*size);





    /*items.getAt(arg).setLabel(items.getAt(arg).getWidth() ); */



    }

    ]]>

  23. Anonymous says:

    < ![CDATA[

    TrianguloY OK I’ll try this one as soon as possible


    😀 

    ]]>

  24. Anonymous says:

    < ![CDATA[

    TrianguloY OK it sets the layout of the zoom scroll but it doesn’t scroll the icons

    ]]>

  25. Anonymous says:

    < ![CDATA[

    Khaleel McGeachy did you follow the instructions? (In the original post)

    ]]>

  26. Anonymous says:

    < ![CDATA[

    TrianguloY yup I did 🙂

    ]]>

  27. Anonymous says:

    < ![CDATA[

    Could you explain with more details what is the problem?

    ]]>

  28. Anonymous says:

    < ![CDATA[

    I tried to use your script to make a vertical scroll bar. unfortunately it did not work, the items are always horizontally arranged 🙁 can you tell me what to change in the script so that i can build me a vertical scroll bar at the right border? 

    ]]>

  29. Anonymous says:

    < ![CDATA[

    I didn’t tested, it may make an error. But try this:



    ———————————————-



    /*Config */


    var see = 5;// Distance between items


    var maxsize = 3; //Max scale of the item






    var desk = LL.getEvent().getContainer();


    var v = desk.getHeight()/2;


    var h = desk.getWidth()/2;


    var pos = desk.getPositionY();



    var items = desk.getItems();



    var n = items.getLength();



    var distance = 2*v/see;



    for(var i=0;i


    var p = Math.floor(pos/distance-n/2 +1);


    var arg = (p+i)%n;


    while(arg<0)arg+=n;



    var item = items.getAt(arg);



    var size = pos-(p+i)*distance ;


    if(size<0)size=-size;


    size=maxsize-( size /v*maxsize );


    if(size<0.1){


    size =0.1;


    item.setPosition( h ,v+(p+i)*distance );


    item.setSize(desk.getWidth()/maxsize,distance/maxsize);


    }



    item.setScale(size,size);



    /*items.getAt(arg).setLabel(items.getAt(arg).getHeight() ); */



    }

    ]]>

  30. Anonymous says:

    < ![CDATA[

    Thank you. It works in “some” way.


    – i cant change panel size (might be fixable by changing the size values of the items in the script)


    – the items are much too big (i can see 3 items at once)


    – item sizes change while scrolling but the pattern is just not right (but it looks quite funny)

    ]]>

  31. Anonymous says:

    < ![CDATA[

    This works (tested)


    Remember thatyou can change the first two numbers, the ‘see’ means the number of items you can see at most (it was 3, that’s why you saw only 3) I changed it to 5, but change it as you want.


    The maxsize is only in case all items are very big or very small.



    About the panel size: make sure you are in edit mode of the desktop and you will be able to change the panel’s size as a normal item.



    If you have more questions just ask 🙂




    ———



    /*Config */


    var see = 5;// Items you can see


    var maxsize = 1; //Max scale of the item






    var desk = LL.getEvent().getContainer();


    var v = desk.getHeight()/2;


    var h = desk.getWidth()/2;


    var pos = desk.getPositionY();



    var items = desk.getItems();



    var n = items.getLength();



    var distance = 2*v/see;



    for(var i=0;i


    var p = Math.floor(pos/distance-n/2 +1);


    var arg = (p+i)%n;


    while(arg<0)arg+=n;



    var item = items.getAt(arg);



    var size = pos-(p+i)*distance ;


    if(size<0)size=-size;


    size=maxsize-( size /v*maxsize );


    if(size<0.1){


    size =0.1;


    }



    item.setScale(0.1,0.1);


    item.setPosition( h,v +(p+i)*distance );


    item.setSize(desk.getWidth()/maxsize,distance/maxsize);



    item.setScale(size,size);



    /*items.getAt(arg).setLabel(items.getAt(arg).getHeight() ); */



    }

    ]]>

  32. Anonymous says:

    < ![CDATA[

    Yes! Thank you, it works. Sorry it was actually my fault. i didn’t use a panel but a folder as sidebar 🙂

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *