Skip to content

Instantly share code, notes, and snippets.

@popeating
Created February 8, 2021 16:35
Show Gist options
  • Save popeating/7c114d226efc013a910d37b9dbaf6d02 to your computer and use it in GitHub Desktop.
Save popeating/7c114d226efc013a910d37b9dbaf6d02 to your computer and use it in GitHub Desktop.
useEffect(() => {
gsap.to('.hometex', {
autoAlpha: 1,
duration: 1,
});
}, []); //THIS IS RUN THE FIRST TIME THE SITE IS OPENED
useEffect(() => {
if (transitionStatus === 'entering') {
gsap.to('.hometex', {
autoAlpha: 1,
duration: 1, //if we are entering the page, let's make the div with class .hometex visible in one second
});
}
if (transitionStatus === 'exiting') {
gsap.to('.hometex', { autoAlpha: 0, duration: 1 });//if we are exiting the page, let's make the div with class .hometex transparent in one second
}
}, [transitionStatus]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment