Jump to content
Search Community

Animation on load and than on scroll on the same element.

alonK test
Moderator Tag

Recommended Posts

Thanks again for this awesome plugin,

I'm trying to combine 2 animations,

 

Onload text change opacity from 0 to 1

Onscroll text change opacity from 1 to 0

 

In my local dev site the opacity jumps when you start to scroll with no ease or scrub, I guess the 2 timelines are effecting each other.

 

I tried to create the error on a codepen and could not, it seem to work fine in the codepen, but you can see what I'm trying to do.

I'm looking for a way to work correctly with 2 timeline on the same element on load and on scroll not effecting each other,

 

Thanks for the help!

 

See the Pen LYqdZmK by Aloillu (@Aloillu) on CodePen

Link to comment
Share on other sites

I would create a timeline of your first animation and let the timeline handle the timing/delay with the use of the position parameter. And onComplete of that timeline call a function on which with you crate your ScrollTrigger. 

 

I think you've got two options getting this effect to work, but either one has it's downsites 

  1. Disable scroll until your animations is done, this kinda feels like the page is defect and/or there is no more content on the page. Maybe adding a arrow down that bounces when your animation is done is a solution?
  2. In the ScrollTrigger function, check if the visitor  has already scrolled and then don't create the ScrollTrigger. This way there will be no scroll animation, but the visitor is probably in a hurry, so how much that matters is up to you. 

Hope it helps and happy tweening!  

 

See the Pen oNmqoPK?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

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