Last active
January 21, 2021 01:25
-
-
Save pigeonfresh/6d7938ebaf6ad46cfe5b540eeadf6e87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gsap, Power3 } from 'gsap'; | |
export const baseTransition = ( | |
elements: HTMLElement | ReadonlyArray<HTMLElement>, | |
props?: gsap.AnimationVars, | |
): gsap.core.Animation => | |
gsap.from(elements, { | |
duration: 1.2, | |
y: 40, | |
ease: Power3.easeOut, | |
autoAlpha: 0, | |
stagger: 0.1, | |
...props, | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scrollTransition(this.element, baseTransition(transitionItems)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gsap } from 'gsap'; | |
import ScrollTrigger from 'gsap/ScrollTrigger'; | |
gsap.registerPlugin(ScrollTrigger); | |
export const scrollTransition = ( | |
trigger: HTMLElement, | |
animation: gsap.core.Animation, | |
props?: Object, | |
): gsap.plugins.ScrollTriggerInstance => | |
ScrollTrigger.create({ | |
trigger, | |
animation, | |
toggleActions: 'play complete none none', | |
start: 'top 65%', | |
...props, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment