Jump to content
GreenSock

rgfx

Starting from random positions.

Go to solution Solved by lunelson@gmail.com,

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 wanted to stagger in a none linear manner. Animate elements randomly. Messed around with a loop and random delays, but I think timeline wont loop until is done. Stagger and TweenMax didn't seem to work inside my loop using my variable, surely a lack of skill is involved. 

 

Wonder if its possible without animating each element individually. 

 

Thanks. 

See the Pen ByZeRB by rgfx (@rgfx) on CodePen

Link to comment
Share on other sites

I think your random function is a little off. Try this one.

function getRandomInt(min, max) {
  return min + Math.floor(Math.random() * (max - min + 1));
}

See the Pen NPgZyw by osublake (@osublake) on CodePen

  • Like 2
Link to comment
Share on other sites

Hi Guys :)

 

rgfx , i think with random durations you can have more effective tweens :

function getRandomInt(min, max) { return Math.random() * (max - min) + min; }

var tl = new TimelineMax();

$(".item").each(function(){
  var dRand = getRandomInt(0,0.7);
  tl.to($(this), dRand, {autoAlpha:1, delay: dRand, ease:Power4.easeInOut});
});
  • Like 2
Link to comment
Share on other sites

Thanks for the help everyone, I wanted the boxes to fade in from different positions. 

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.
×