Jump to content
Search Community

.staggerTo() and shuffling the selection array

smisaacs test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm using the jquery.shuffle plugin.
 
Thinking that it was possibly the issue, I've tried selecting my elements in the two ways below:
 
var goaway = $("#container li:not('.ele1,.ele2,.ele5,.ele6,.ele7')");
var goaway = $('#ele3,#ele4,#ele8,#ele9,#ele10,#ele11,#ele12,#ele13,#ele14,#ele15,#ele16,#ele17,#ele18');
 

 

I'm then shuffling them as so:       
 
var shuf = goaway.shuffle();
 

and tracing:

    console.debug(goaway);
    console.debug(shuf);
 

 

shuffle is good, trace is good.

 
Problem is here:
 
 
            var tl = new TimelineMax({paused:true});
            tl.staggerTo(shuf,.5,{alpha:0},.2);
            tl.play();
 

 

No matter what, the elements stagger based on their order in the DOM not based on their order within the selection array passed.

 
Anyone have any recommendations here?
Link to comment
Share on other sites

I've found the issue.  

 

jquery.shuffle plugin will actually shuffle the selected elements within the DOM it doesn't shuffle the references in the array.  If i use a shuffle function that just returns the reference array all jumbled up, I get the desired effect.

 

I couldn't see this until the items i was animating were different visually.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...