Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
sam_tween_journeyer

How to refactor ScrollTrigger animations into a timeline

Recommended Posts

I have these two animations, a box rotating and contact buttons popping onto the screen. 

 

        ScrollTrigger.create({
            trigger: "#topLetterTrigger",
            animation: gsap.fromTo("#topLetter", {rotateY: -180}, {duration: 2.2, rotateY: 0, ease: "back.out(1.7)"}),
            once: true
        });
        gsap.set(".contact-icon", {scale: 0});
        ScrollTrigger.batch(".contact-icon", {
            trigger: "#topLetterTrigger",
            interval: 3,
            batchMax: 4,
            once: true,
            onEnter: batch => 
                gsap.to(batch, {delay: 0.5, duration: 0.8, scale: 1, stagger: {each: 0.25, grid: [14]}, overwrite: true, ease: "back.out(1.7)"}).delay(1.4),
        });

 

The delay on the batch animation is supposed to make the animations end at roughly the same time.  However it doesn't, it seems sometimes the second trigger doesn't fire, or it starts the second animation when the first animation has completed, so instead of completing together the second animation commences at the end of the 1st animation + 1.4 second delay.

 

Note: is there an issue where you shouldn't have 2 animations given the same trigger: value?

 

I think using a timeline and the ScrollTrigger-ing them both will make it more robust. 

Or there is some other better way?

Link to comment
Share on other sites

Hello there Sam!

Could you possible put a minimal demo together for us? ScrollTrigger is very tied in to layout and positioning of elements so it's hard to debug without context.

Thanks.

  • Like 3
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.
×