Jump to content
Search Community

Cancel Image Reveal Effect Repeat

Sıradışı Digital test
Moderator Tag

Go to solution Solved by Carl,

Recommended Posts

Hello, I have a sample project at codepen.io. The image opens when you scroll down the page. When it goes up, the picture turns off. I just want the picture to open when it goes down. When you go up again, the picture does not turn off. Animation needs to run once. Would you help me with this topic?

See the Pen bGjeorr by mrtsiradisi (@mrtsiradisi) on CodePen

Link to comment
Share on other sites

Hello there,

 

if you only want to disable it once it has reached its final position, you could just set once: true on the ScrollTrigger.

 

See the Pen ZEjOaBg by akapowl (@akapowl) on CodePen

 

 

 

If on the other hand you only want it to scrub in one direction to begin with, here's an example that shows how you could achieve that, leveraging the onUpdate callback of a ScrollTrigger.

 

See the Pen abZjjNr by GreenSock (@GreenSock) on CodePen

 

  • Like 2
Link to comment
Share on other sites

  • Solution

thanks for the demo. nice job!

 

If you want a ScrollTrigger animation to only run once you can set once:true

 

See the Pen ExpybZV?editors=0010 by snorkltv (@snorkltv) on CodePen

 

From https://greensock.com/docs/v3/Plugins/ScrollTrigger

 

 

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".
  • Like 2
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...