This class bundles gsap
methods together for fast use.
NOTE: the
selector
may be an#id
,.class
,tag
as you wish. All functions returnTween
/gsap.timeline()
.
Requires:
-
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js
-
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollToPlugi
-
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollTrigger
to be imported in the index.html beforehand.
(For some reason, this CDN cannot be imported within.js
files.)
index.html:
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollToPlugin.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.8.0/ScrollTrigger.min.js"></script>
<script src="main.js" type="module"></script>
main.js:
import {GsapWrapper} from "./gsap/gsap-wrapper.js";
GsapWrapper.fadeUp(".class-name"); // Example of use.