Jump to content
Search Community

Stagger through loop with ScrollMagic

fpalla test
Moderator Tag

Recommended Posts

Hey guys, noob here.

This might be a fairly simple problem and I've tried to look it up in the past forums but at this point I think I don't have the technical lexical ability to use the correct terms.

 

I'm trying to stagger an animation that comes from a list of classes, triggered via ScrollMagic.

As in the example, the red divs animate when in view.

 

I'd like to have them staggered, by what's visible. I think I see the problem, but I don't know how to solve it.

Meaning I need to apply the stagger property in a different way, given that currently "each" element stands by itself. (might be wrong here)

 

Thank you so much,

have a great day!

See the Pen yLOJGNJ by fvalla (@fvalla) on CodePen

Link to comment
Share on other sites

Hi @fpalla

 

ScrollMagic is not a GreenSock product and not supported on the forum.

 

ScrollTrigger is GreenSock's product which does everything SM does and whole lot more.

If I understand your specific question correctly, I think you'd want to look at the .batch() method of ScrollTrigger.

https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.batch()

 

Happy tweening.

:)

 

  • Like 3
  • Haha 1
Link to comment
Share on other sites

Hey @fpalla

 

You definitely mean ScrollTrigger, not ScrollMagic ;) ...ScrollMagic is not a Greensock product - the ScrollTrigger you are using, is though.

 

Is this what you are after?

 

See the Pen 4bf05bb3fac366ab49dbbc6ebab671f0 by akapowl (@akapowl) on CodePen

 

I just simply added the stagger like so:

 

ScrollTrigger.batch(".p-img", {
  
  onEnter: batch => gsap.from(batch, .9, { ease: Power3.easeOut, width: "0", stagger: 0.3 })
  
});

 

 

  • Like 4
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...