Jump to content
Search Community

Adding delay to ScrollTrigger timeline.

Wilson1077 test
Moderator Tag

Recommended Posts

Hi,

 

I am trying to add a small delay to the start my ScrollTrigger timeline with scrub. Basically as soon as the pin starts the opacity begins to fade, I would like a small delay before that happens.

 

My current solution is to use an empty tween ('.empty-tween' is not a real element) at the beginning as shown below. However, I thought this looks/feels a bit inelegant and was hoping there was a better solution.

 

    timeline = gsap.timeline({
      scrollTrigger: {
        trigger: '.logo_block_content_block',
        start: 'center center',
        end: '+=100%',
        scrub: true,
        pin: 'body',
        pinSpacing: false
      }
    })
    .to('.empty-tween', {opacity: "1"}, "scene-0")
    .to('.example', {fill: "#F5F5F5"}, "scene-1")
    .to('.example1', {opacity: 0}, "scene-1")
    .to('.example2', {fill: "#1C3661"}, "scene-2")
    .to('.example3', {fill: "#6fc4c2"}, "scene-2")
    .to('.example4', {fill: "#6ab651"}, "scene-2")

 

Many thanks,

Liam

 

Link to comment
Share on other sites

  • 1 year later...
var mission_animation = gsap.timeline();
 
mission_animation.set(goal1, { className: "block-mission__goal block-mission__goal--1 block-mission__goal--active"}, "1")
mission_animation.to('body',{ delay: 80 }, "1")
mission_animation.set(goal1, { className: "block-mission__goal block-mission__goal--1 "}, "2")
mission_animation.set(link1, { className: "block-mission__link block-mission__link--1"}, "2")
mission_animation.set(link2, { className: "block-mission__link block-mission__link--2 block-mission__link--active"}, "2")
mission_animation.set(goal2, { className: "block-mission__goal block-mission__goal--1 block-mission__goal--active"}, "2")
mission_animation.to('body',{ delay: 10 }, "2")
mission_animation.set(link2, { className: "block-mission__link block-mission__link--1"}, "3")
mission_animation.set(link3, { className: "block-mission__link block-mission__link--3 block-mission__link--active"}, "3")
mission_animation.set(goal2, { className: "block-mission__goal block-mission__goal--1 "}, "3")
mission_animation.set(goal3, { className: "block-mission__goal block-mission__goal--1 block-mission__goal--active"}, "3")
mission_animation.to('body',{ delay: 10 }, "3")

 

I'm doing this, but the scrub rushes trough the scenes and only the last scenes is visible till I scroll out.

any ideas?

Link to comment
Share on other sites

Hi,

 

Is really hard for us to solve issues without a minimal demo. Please try to re-create what you have in the simplest possible way so we can have a better idea of the problem.

 

What I can see from the code you shared is that you are adding extremely long delays (80 and 10 seconds) to your timeline and then in the timeline's instances you're passing just a string with a number which GSAP interprets as an absolute position, so all your instances are added at 1, 2 and 3 seconds but you add a delay of 80 in the timeline at the same position of the first instance.

 

Take a deeper look at the docs for Timelines and the position parameter to better understand how it works:

https://greensock.com/docs/v3/GSAP/Timeline

 

Let us know if you have more questions.

Happy Tweening!

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