Created
February 27, 2021 12:46
-
-
Save BekaArabidze/e3a1d44a77f28998b62cf476a5b171f5 to your computer and use it in GitHub Desktop.
This file contains 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/dist/ScrollTrigger"; | |
export const scrollElemAnim = (elementsToAnimation: string) => { | |
gsap.registerPlugin(ScrollTrigger); | |
const el = document.querySelectorAll(elementsToAnimation); | |
el.forEach((elem, i) => { | |
let tl = gsap.timeline({ | |
scrollTrigger: { | |
trigger: elem, | |
toggleActions: "play none none none", | |
start: "center bottom", | |
// end: "bottom 50%+=100px", | |
}, | |
}) | |
tl.to(elem, { | |
ease: "Expo.easeOut", | |
opacity: 1, | |
transform: "translateY(0) skewY(0)", | |
duration: i * .2, | |
deley: 0.5 | |
}) | |
}) | |
}; | |
/* .scrollAnim { | |
transform:translateY(30%) skewY(20deg); | |
transform-origin: top left; | |
opacity: 0; | |
} | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment