gsap-dattebayo
Version:
The ultimate GSAP-powered scroll animation library - Simple as AOS, powerful as GSAP. Modern animations for 2025-2026 web trends.
10 lines (9 loc) • 5.71 kB
JavaScript
/*!
* GSAP Dattebayo v0.1.0-alpha.1
* The ultimate GSAP-powered scroll animation library
* https://github.com/serdjan/gsap-dattebayo
*
* Copyright 2025 GSAP Dattebayo
* Released under the MIT License
*/
import e from"gsap";import"gsap/ScrollTrigger";import t from"gsap/SplitText";function r(e){return"string"==typeof e?Array.from(document.querySelectorAll(e)):e instanceof HTMLElement?[e]:e instanceof NodeList?Array.from(e):Array.isArray(e)?e:[]}function o(o,a={}){const{duration:n=1,ease:s="power2.out",delay:i=0,stagger:c=.05,from:d="start"}=a,f=r(o),l=e.timeline({delay:i});return f.forEach(e=>{const r=new t(e,{type:"chars"});l.from(r.chars,{opacity:0,y:20,rotationX:-90,transformOrigin:"0% 50% -50",duration:n,ease:s,stagger:{each:c,from:d},force3D:!0},0)}),l}function a(o,a={}){const{duration:n=.6,ease:s="power2.out",delay:i=0,stagger:c=.03,distance:d=30}=a,f=r(o),l=e.timeline({delay:i});return f.forEach(e=>{const r=new t(e,{type:"chars"});l.from(r.chars,{opacity:0,y:d,duration:n,ease:s,stagger:c,force3D:!0},0)}),l}function n(o,a={}){const{duration:n=.6,ease:s="back.out(1.7)",delay:i=0,stagger:c=.05}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"chars"});f.from(r.chars,{opacity:0,y:-50,rotation:10,scale:0,duration:n,ease:s,stagger:{each:c,from:"center"},force3D:!0},0)}),f}function s(o,a={}){const{duration:n=1,ease:s="elastic.out(1, 0.3)",delay:i=0,stagger:c=.04}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"chars"});f.from(r.chars,{opacity:0,scale:0,rotation:360,transformOrigin:"center center",duration:n,ease:s,stagger:c,force3D:!0},0)}),f}function i(o,a={}){const{duration:n=.8,ease:s="power2.out",delay:i=0,stagger:c=.03}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"chars"});f.from(r.chars,{opacity:0,filter:"blur(10px)",scale:1.5,duration:n,ease:s,stagger:c,force3D:!0},0)}),f}function c(o,a={}){const{duration:n=.8,ease:s="power2.out",delay:i=0,stagger:c=.1,distance:d=30,from:f="start"}=a,l=r(o),u=e.timeline({delay:i});return l.forEach(e=>{const r=new t(e,{type:"words"});u.from(r.words,{opacity:0,y:d,duration:n,ease:s,stagger:{each:c,from:f},force3D:!0},0)}),u}function d(o,a={}){const{duration:n=.6,ease:s="back.out(1.7)",delay:i=0,stagger:c=.08}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"words"});f.from(r.words,{opacity:0,scale:0,transformOrigin:"center center",duration:n,ease:s,stagger:c,force3D:!0},0)}),f}function f(o,a={}){const{duration:n=.8,ease:s="power2.out",delay:i=0,stagger:c=.1}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"words"});f.from(r.words,{opacity:0,rotationY:-90,transformOrigin:"left center",transformPerspective:800,duration:n,ease:s,stagger:c,force3D:!0},0)}),f}function l(o,a={}){const{duration:n=.8,ease:s="power3.out",delay:i=0,stagger:c=.08,distance:d=50}=a,f=r(o),l=e.timeline({delay:i});return f.forEach(e=>{new t(e,{type:"words"}).words.forEach((e,t)=>{l.from(e,{opacity:0,x:t%2==0?-d:d,duration:n,ease:s,force3D:!0},t*c)})}),l}function u(o,a={}){const{duration:n=1,ease:s="power3.out",delay:i=0,stagger:c=.15,distance:d=50}=a,f=r(o),l=e.timeline({delay:i});return f.forEach(e=>{const r=new t(e,{type:"lines",linesClass:"line"});l.from(r.lines,{opacity:0,y:d,duration:n,ease:s,stagger:c,force3D:!0},0)}),l}function y(o,a={}){const{duration:n=1.2,ease:s="power4.out",delay:i=0,stagger:c=.1}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"lines",linesClass:"line"});r.lines.forEach(e=>{const t=document.createElement("div");t.style.overflow="hidden",e.parentNode?.insertBefore(t,e),t.appendChild(e)}),f.from(r.lines,{yPercent:100,duration:n,ease:s,stagger:c,force3D:!0},0)}),f}function g(o,a={}){const{duration:n=1,ease:s="power2.out",delay:i=0,stagger:c=.12,distance:d=100}=a,f=r(o),l=e.timeline({delay:i});return f.forEach(e=>{new t(e,{type:"lines"}).lines.forEach((e,t)=>{l.from(e,{opacity:0,x:t%2==0?-d:d,duration:n,ease:s,force3D:!0},t*c)})}),l}function m(o,a={}){const{duration:n=1,ease:s="back.out(1.7)",delay:i=0,stagger:c=.1}=a,d=r(o),f=e.timeline({delay:i});return d.forEach(e=>{const r=new t(e,{type:"lines"});f.from(r.lines,{opacity:0,scaleX:0,transformOrigin:"left center",duration:n,ease:s,stagger:c,force3D:!0},0)}),f}function p(t,o={}){const{duration:a=2,delay:n=0,chars:s="lowerCase"}=o,i=r(t),c=e.timeline({delay:n});return i.forEach(e=>{const t=e.textContent||"";c.to(e,{scrambleText:{text:t,chars:s,speed:.3},duration:a,ease:"none"},0)}),c}function h(t,o={}){const{duration:a=1.5,ease:n="power2.out",delay:s=0}=o,i=r(t),c=e.timeline({delay:s});return i.forEach(e=>{e.textContent,e.style.position="relative";for(let t=0;t<8;t++){const r=a/8*t;c.fromTo(e,{opacity:0,x:10*Math.random()-5,skewX:20*Math.random()-10,filter:`hue-rotate(${360*Math.random()}deg)`},{opacity:1,x:0,skewX:0,filter:"hue-rotate(0deg)",duration:a/8,ease:n,force3D:!0},r)}}),c}function w(o,a={}){const{duration:n=2,delay:s=0,chars:i="01",stagger:c=.05}=a,d=r(o),f=e.timeline({delay:s});return d.forEach(e=>{const r=new t(e,{type:"chars"});r.chars.forEach((e,t)=>{const r=e.textContent||"",o=.7*n,a=o+t*c;for(let t=0;t<10;t++)f.to({},{duration:o/10,onStart:()=>{e.textContent=i.charAt(Math.floor(Math.random()*i.length))}},o/10*t);f.to({},{duration:.1,onComplete:()=>{e.textContent=r}},a),f.from(e,{opacity:0,y:-20,duration:.3,ease:"power2.out",force3D:!0},a)})}),f}export{i as charBlur,s as charElastic,a as charFadeUp,o as charReveal,n as charWave,h as glitchReveal,y as lineClipReveal,u as lineReveal,m as lineScaleReveal,g as lineSlideAlternate,w as matrixReveal,p as scrambleReveal,c as wordReveal,f as wordRotateIn,d as wordScaleIn,l as wordSlideAlternate};