Jump to content
Search Community

Changing any of scroll trigger variables status after completition.

Sercotec test
Moderator Tag

Recommended Posts

I won't provide a demo this time because i dont know if it is achivable a hypotethic question:

 

Is it possible to change a scroll trigger variable after completition of animation. A sample code like :

 

var tl = gsap.timeline({
    scrollTrigger: {
    trigger: ".hero",
    start: "center 50%",
    end: "bottom top",
 toggleActions: "play reset restart resume",
    //markers: true,
    scrub:1,
        pin:".hero",
        pinSpacing:true

(Something like : onComplete () => pinSpacing:false)


    }
})

 

Thanks in advance!

Link to comment
Share on other sites

I don' think that'd make much sense because if you suddenly got rid of pinSpacing when it completed, all the stuff on your page would suddenly jump because the pinSpacing would collapse. 

 

Can you help us understand why you want to do something like this? I mean you can definitely disable() a ScrollTrigger or kill() it or set once: true so that it only plays once. 

 

By the way, if you set a scrub value, that overrules any toggleActions (it's logically impossible to have both), FYI. 

 

A minimal demo would go a long way toward helping us understand what you're attempting. 

Link to comment
Share on other sites

Its live demo on :

https://sercotec.net/demo/gsap/

 

I want orange section to overlap first section after the animation of texts finished.

if i use pinSpace:false it overlaps yet animation is not finished yet.

 

So getting rid of Pinspacing not affecting entire page but only the animation of these two sections. ( I can implement other scrollTriggers for the rest of the page)

 

And i dont want to put sections to Arrays like you do in your demos.

 

I hope it helps.

Thank you.

 

Link to comment
Share on other sites

Actually i found a sample :

See the Pen 274c3f7a269a327db37dcd069fd6ed20 by akapowl (@akapowl) on CodePen

 

this is exactly what i want to achive yet  i couldnt solve the relation between those codes (they definetely do the trick) : (you can check it in pen's code)

gsap.set('.content', { marginTop: "-100vh" })

 

....

 

 end: '+=' + (600 + window.innerHeight) 

 

...

 

 end: '+=600px'

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