Jump to content

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

Is there a way to run .batch method only once?

Recommended Posts

As the title says, is there a way to stop the .batch animation from running? I just want it to run only once but it keeps running after entering in the trigger.


ScrollTrigger.batch(".fadeIn, .fadeIns > *", {
  onEnter: (batch) =>
    gsap.from(batch, {
    y: "100%",
    opacity: 0,
    duration: 1,
    delay: 0.25,
    stagger: 0.125,
    ease: "power3.out",
Link to comment
Share on other sites

Hey @Brandonjhz


You should be able to set once: true for it to only trigger once.



Boolean - If true, the ScrollTrigger will kill() itself as soon as the end position is reached once. This causes it to stop listening for scroll events and it becomes eligible for garbage collection. This will only call onEnter a maximum of one time as well. It does not kill the associated animation. It's perfect for times when you only want an animation to play once when scrolling forward and never get reset or replayed. It also sets the toggleActions to "play none none none".




See the Pen 3545e02fd00d0a1fd8fb3aea2472820f by akapowl (@akapowl) on CodePen


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