Jump to content
Search Community

How do you add a trigger on multiple timelines within timelines?

Beaowulf test
Moderator Tag

Go to solution Solved by ZachSaucier,

Recommended Posts

  var masterTimeline = new TimelineMax();
masterTimeline
  .add(part1())
  .add(part2(), "-=2.2")
  .add(part3(), "-=2.2")
  .add(part4(), "-=2.2");

 

 

part1, part2.... all of these are multiple timelines with animations inside of them.

Only "trigger" that the animations have are for example this: All my animations are about the same code as below...

 

 


"
    tl.from(".card4 .sect8-greentick-text p", {
            scrollTrigger:{
                trigger: ".card1", //Here
            },
            stagger: 0.1,
            autoAlpha: 0,
            duration: 0.5,
            x: "-50",
          }, '<.2');
""

 

Question is how do I add a Parent trigger on masterTimeline? to run all animations?

Link to comment
Share on other sites

image.thumb.png.95617e879b82d11614fc60d4e8ce0a9c.png

Thanks for your response, Im still at a noob phase and im trying to learn,

 

 

I hope the above (Screenshot) makes sense. My main goal that I cant seem to achieve is: "When I scroll at this section of the website" I want my animations to start playing.

 

The screenshot provided above plays as follow.

1st box. 1st box will come from bottom up, 2nd text will start displaying 1 by 1.

same for 2nd box, 3rd box and 4thbox.

 

 

1st box is its own timeline..

2nd box its own......4th its own. All these are within a bigger masterTimeline. as shown on the code:

 

"

var masterTimeline = new TimelineMax();
masterTimeline
  .add(part1())
  .add(part2(), "-=2.2")
  .add(part3(), "-=2.2")
  .add(part4(), "-=2.2");

 

"

So back to my main goal, how and or where should / can I add the trigger. Right now just as I load the website its playing without me even reaching there (i.e I cant seem to get the trigger point right)...

 

 

 

Thanks for answering this fast If more info is needed I will try to create my example on codepen...

Link to comment
Share on other sites

hey @ZachSaucier

 

While creating the sample code in codepen I found a way to fix it according to what you have told me to do!

 

I will also be reading up on migrating to gsap3, thanks alot for your help!

 

 

 

I will post the code below (for reference)...

 

var masterTimeline = new TimelineMax({
    scrollTrigger:{
      trigger:".card",
      markers: true,
      start:"50% bottom",
      end:"bottom bottom",
      }});
  
masterTimeline
.add(part1())
.add(part2(), "+0.7")
.add(part3(), "+1.2")
.add(part4(), "+1.5")
 "
Link to comment
Share on other sites

On 11/15/2020 at 2:43 AM, Beaowulf said:

I found a way to fix it according to what you have told me to do!

Good work!

 

On 11/15/2020 at 2:43 AM, Beaowulf said:

I will also be reading up on migrating to gsap3, thanks alot for your help!

Glad to hear it. In your code, that means switching out new TimelineMax for gsap.timeline

 

One other thing: "+0.7" doesn't make much sense. You either want just 0.7 or "+=0.7" as the position parameter. For more info see this post.

  • Like 1
Link to comment
Share on other sites

"Glad to hear it. In your code, that means switching out new TimelineMax for gsap.timeline.  " - Noted and fixed!

 

"One other thing: "+0.7" doesn't make much sense. You either want just 0.7 or "+=0.7" as the position parameter. For more info see this post." -Will read!

 

Again thanks

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