sap-sap-trial-suhaib
Version:
Trial version of GSAP that includes all bonus plugins which are normally available exclusively to Club GSAP members. *** DO NOT DEPLOY THESE FILES *** They only work locally or on domains like codepen.io, codesandbox.io, stackblitz.com and jsfiddle.com. I
11 lines • 17.7 kB
JavaScript
/*!
* ScrollSmoother 3.12.7
* https://gsap.com
*
* @license Copyright 2025, GreenSock. All rights reserved.
* *** DO NOT DEPLOY THIS FILE ***
* This is a trial version that only works locally and on domains like codepen.io and codesandbox.io.
* Loading it on an unauthorized domain violates the license and will cause a redirect.
* Get the unrestricted file by joining Club GSAP at https://gsap.com/pricing
* @author: Jack Doyle, jack@greensock.com
*/ !function(_,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((_=_||self).window=_.window||{})}(this,function(_){"use strict";function e(_,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(_,r.key,r)}}function t(){return"undefined"!=typeof window}function r(){return a||t()&&(a=window.gsap)&&a.registerPlugin&&a}function n(){return String.fromCharCode.apply(null,arguments)}function $(_){return h.maxScroll(_||c)}var o,i,s,a,l,c,f,u,d,p,g,h,v,m,y,b,S,w,T="ScrollSmoother",x=n(103,114,101,101,110,115,111,99,107,46,99,111,109),C=n(103,115,97,112,46,99,111,109),E=/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}:?\d*$/,P=(function(_){var e="undefined"!=typeof window,t=0===(e?window.location.href:"").indexOf(n(102,105,108,101,58,47,47))||-1!==_.indexOf(n(108,111,99,97,108,104,111,115,116))||E.test(_)||(e?window.location.hostname:"").split(".").pop()===n(108,111,99,97,108),r=[x,C,n(99,111,100,101,112,101,110,46,105,111),n(99,101,111,45,103,105,108,116,46,118,101,114,99,101,108,46,97,112,112),n(99,111,100,101,112,101,110,46,112,108,117,109,98,105,110,103),n(99,111,100,101,112,101,110,46,100,101,118),n(99,111,100,101,112,101,110,46,97,112,112),n(99,111,100,101,112,101,110,46,119,101,98,115,105,116,101),n(112,101,110,115,46,99,108,111,117,100),n(99,115,115,45,116,114,105,99,107,115,46,99,111,109),n(99,100,112,110,46,105,111),n(112,101,110,115,46,105,111),n(99,101,111,46,112,114,111,116,111,111,108,46,99,111,46,105, 110),n(103,97,110,110,111,110,46,116,118),n(99,111,100,101,99,97,110,121,111,110,46,110,101,116),n(116,104,101,109,101,102,111,114,101,115,116,46,110,101,116),n(99,101,114,101,98,114,97,120,46,99,111,46,117,107),n(116,121,109,112,97,110,117,115,46,110,101,116),n(116,119,101,101,110,109,97,120,46,99,111,109),n(112,108,110,107,114,46,99,111),n(104,111,116,106,97,114,46,99,111,109),n(119,101,98,112,97,99,107,98,105,110,46,99,111,109),n(97,114,99,104,105,118,101,46,111,114,103),n(99,111,100,101,115,97,110,100,98,111,120,46,105,111),n(99,115,98,46,97,112,112),n(115,116,97,99,107,98,108,105,116,122,46,99,111,109),n(115,116,97,99,107,98,108,105,116,122,46,105,111),n(99,111,100,105,101,114,46,105,111),n(109,111,116,105,111,110,116,114,105,99,107,115,46,99,111,109),n(115,116,97,99,107,111,118,101,114,102,108,111,119,46,99,111,109),n(115,116,97,99,107,101,120,99,104,97,110,103,101,46,99,111,109),n(115,116,117,100,105,111,102,114,101,105,103,104,116,46,99,111,109),n(119,101,98,99,111,110,116,97,105,110,101,114,46,105,111),n(106,115,102,105,100,100,108,101,46,110,101,116)],$=r.length;for(setTimeout(function _(){if(e){if("loading"===document.readyState||"interactive"===document.readyState)document.addEventListener("readystatechange",_);else{document.removeEventListener("readystatechange",_);var t="object"==typeof a?a:e&&window.gsap;e&&window.console&&!window._gsapWarned&&"object"==typeof t&&!1!==t.config().trialWarn&&(console.log(n(37,99,87,97,114,110,105,110,103),n(102,111,110,116,45,115,105,122,101,58,51,48,112,120,59,99,111,108,111,114,58,114,101,100,59)),console.log(n(65,32,116,114,105,97,108,32,118,101,114,115,105,111,110,32,111,102,32)+T+n(32,105,115,32,108,111,97,100,101,100,32,116,104,97,116,32,111,110,108,121,32,119,111,114,107,115,32,108,111,99,97,108,108,121,32,97,110,100,32,111,110,32,100,111,109,97,105,110,115,32,108,105,107,101,32,99,111,100,101,112,101,110,46,105,111,32,97,110,100,32,99,111,100,101,115,97,110,100,98,111,120,46,105,111,46,32,42,42,42,32,68,79,32,78,79,84,32,68,69,80,76,79,89,32,84,72,73,83,32,70,73,76,69,32,42,42,42,32,76,111,97,100,105,110,103,32,105,116,32,111,110,32,97,110,32,117,110,97,117,116,104,111,114,105,122,101,100,32,115,105,116,101,32,118,105,111,108,97,116,101,115,32,116,104,101,32,108,105,99,101,110,115,101,32,97,110,100,32,119,105,108,108,32,99,97,117,115,101,32,97,32,114,101,100,105,114,101,99,116,46,32,80,108,101,97,115,101,32,106,111,105,110,32,67,108,117,98,32,71,114,101,101,110,83,111,99,107,32,116,111,32,103,101,116,32,102,117,108,108,32,97,99,99,101,115,115,32,116,111,32,116,104,101,32,98,111,110,117,115,32,112,108,117,103,105,110,115,32,116,104,97,116,32,98,111,111,115,116,32,121,111,117,114,32,97,110,105,109,97,116,105,111,110,32,115,117,112,101,114,112,111,119,101,114,115,46,32,68,105,115,97,98,108,101,32,116,104,105,115,32,119,97,114,110,105,110,103,32,119,105,116,104,32,103,115,97,112,46,99,111,110,102,105,103,40,123,116,114,105,97,108,87,97,114,110,58,32,102,97,108,115,101,125,41,59)),console.log(n(37,99,71,101,116,32,117,110,114,101,115,116,114,105,99,116,101,100,32,102,105,108,101,115,32,97,116,32,104,116,116,112,115,58,47,47,103,114,101,101,110,115,111,99,107,46,99,111,109,47,99,108,117,98),n(102,111,110,116,45,115,105,122,101,58,49,54,112,120,59,99,111,108,111,114,58,35,52,101,57,56,49,53)),window._gsapWarned=1)}}},50);-1<--$;)if(-1!==_.indexOf(r[$]))return;t||setTimeout(function(){e&&(window.location.href=n(104,116,116,112,115,58,47,47)+x+n(47,114,101,113,117,105,114,101,115,45,109,101,109,98,101,114,115,104,105,112,47)+"?plugin="+T+"&source=trial")},4e3)}("undefined"!=typeof window?window.location.host:""),k.register=function _(e){return l||(a=e||r(),t()&&window.document&&(c=window,u=(f=document).documentElement,d=f.body),a&&(p=a.utils.toArray,g=a.utils.clamp,m=a.parseEase("expo"),S=a.core.context||function(){},h=a.core.globals().ScrollTrigger,a.core.globals("ScrollSmoother",k),d&&h&&(w=a.delayedCall(.2,function(){return h.isRefreshing||v&&v.refresh()}).pause(),y=h.core._getVelocityProp,b=h.core._inputObserver,k.refresh=h.refresh,l=1))),l},o=k,i=[{key:"progress",get:function _(){return this.scrollTrigger?this.scrollTrigger.animation._time/100:0}}],e(o.prototype,i),s&&e(o,s),k);function k(_){var e=this;function t(){return _l.update(-_i)}function r(){return z.style.overflow="visible"}function n(_){_.update();var e=_.getTween();e&&(e.pause(),e._time=e._dur,e._tTime=e._tDur),Y=!1,_.animation.progress(_.progress,!0)}function o(_,e){(_!==_i&&!j||e)&&(_e&&(_=Math.round(_)),_$&&(z.style.transform="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, "+_+", 0, 1)",z._gsap.y=_+"px"),_s=_-_i,_i=_,h.isUpdating||k.isRefreshing||h.update())}function i(_){return arguments.length?(_<0&&(_=0),_c.y=-_,Y=!0,j?_i=-_:o(-_),h.isRefreshing?B.update():_n(_/_o),this):-_i}function s(_){H.scrollTop=0,_.target.contains&&_.target.contains(H)||Z&&!1===Z(e,_)||(h.isInViewport(_.target)||_.target===K||e.scrollTo(_.target,!1,"center center"),K=_.target)}function T(_,e){if(_<e.start)return _;var t=isNaN(e.ratio)?1:e.ratio,r=e.end-e.start,n=_-e.start,o=e.offset||0,i=e.pins||[],s=i.offset||0,a=e._startClamp&&e.start<=0||e.pins&&e.pins.offset?0:e._endClamp&&e.end===$()?1:.5;return i.forEach(function(e){r-=e.distance,e.nativeStart<=_&&(n-=e.distance)}),s&&(n*=(r-s/t)/r),_+(n-o*a)/t-n}function x(_,e){O.forEach(function(t){return function _(e,t,r){r||(e.pins.length=e.pins.offset=0);var n,$,o,i,s,l,c,f,u=e.pins,d=e.markers;for(c=0;c<t.length;c++)if(f=t[c],e.trigger&&f.trigger&&e!==f&&(f.trigger===e.trigger||f.pinnedContainer===e.trigger||e.trigger.contains(f.trigger))&&(s=f._startNative||f._startClamp||f.start,l=f._endNative||f._endClamp||f.end,o=T(s,e),i=f.pin&&0<l?o+(l-s):T(l,e),f.setPositions(o,i,!0,(f._startClamp?Math.max(0,o):o)-s),f.markerStart&&d.push(a.quickSetter([f.markerStart,f.markerEnd],"y","px")),f.pin&&0<f.end&&!r)){if(n=f.end-f.start,$=e._startClamp&&f.start<0){if(0<e.start)return e.setPositions(0,e.end+(e._startNative-e.start),!0),void _(e,t);n+=f.start,u.offset=-f.start}u.push({start:f.start,nativeStart:s,end:f.end,distance:n,trig:f}),e.setPositions(e.start,e.end+($?-f.start:n),!0)}}(t,_,e)})}function C(){u=f.documentElement,d=f.body,r(),requestAnimationFrame(r),O&&(h.getAll().forEach(function(_){_._startNative=_.start,_._endNative=_.end}),O.forEach(function(_){var e=_._startClamp||_.start,t=_.autoSpeed?Math.min($(),_.end):e+Math.abs((_.end-e)/_.ratio),r=t-_.end;if((t-=r/2)<(e-=r/2)){var n=e;e=t,t=n}_._startClamp&&e<0?(r=(t=_.ratio<0?$():_.end/_.ratio)-_.end,e=0):(_.ratio<0||_._endClamp&&t>=$())&&(r=((t=$())-(e=_.ratio<0||1<_.ratio?0:t-(t-_.start)/_.ratio))*_.ratio-(_.end-_.start)),_.offset=r||1e-4,_.pins.length=_.pins.offset=0,_.setPositions(e,t,!0)}),x(h.sort())),_l.reset()}function E(){return h.addEventListener("refresh",C)}function P(){return O&&O.forEach(function(_){return _.vars.onRefresh(_)})}function R(){return O&&O.forEach(function(_){return _.vars.onRefreshInit(_)}),P}function A(_,e,t,r){return function(){var n="function"==typeof e?e(t,r):e;n||0===n||(n=r.getAttribute("data-"+_r+_)||("speed"===_?1:0)),r.setAttribute("data-"+_r+_,n);var $="clamp("===(n+"").substr(0,6);return{clamp:$,value:$?n.substr(6,n.length-7):n}}}function L(_,e,t,r,n){function o(){e=b(),t=parseFloat(S().value),l=parseFloat(e.value)||1,v=(d="auto"===e.value)||f&&f._startClamp&&f.start<=0||x.offset?0:f&&f._endClamp&&f.end===$()?1:.5,p&&p.kill(),p=t&&a.to(_,{ease:m,overwrite:!1,y:"+=0",duration:t}),f&&(f.ratio=l,f.autoSpeed=d)}function i(){T.y=w+"px",T.renderTransform(1),o()}function s(e){if(d){i();var t,r,n,$,o,s,a,f,h,v,m,b=(t=_,r=g(0,1,-e.start/(e.end-e.start)),o=t.parentNode||u,s=t.getBoundingClientRect(),f=(a=o.getBoundingClientRect()).top-s.top,m=-(v=(Math.abs(f)>Math.abs(h=a.bottom-s.bottom)?f:h)/(1-r))*r,0<v&&($=.5==(n=a.height/(c.innerHeight+a.height))?2*a.height:2*Math.min(a.height,Math.abs(-v*n/(2*n-1)))*(r||1),m+=r?-$*r:-$/2,v+=$),{change:v,offset:m});E=b.change,y=b.offset}else y=x.offset||0,E=(e.end-e.start-y)*(1-l);x.forEach(function(_){return E-=_.distance*(1-l)}),e.offset=E||.001,e.vars.onUpdate(e),p&&p.progress(1)}n=("function"==typeof n?n(r,_):n)||0;var l,f,d,p,v,y,b=A("speed",e,r,_),S=A("lag",t,r,_),w=a.getProperty(_,"y"),T=_._gsap,x=[],C=[],E=0;return o(),(1!==l||d||p)&&(s(f=h.create({trigger:d?_.parentNode:_,start:function _(){return e.clamp?"clamp(top bottom+="+n+")":"top bottom+="+n},end:function _(){return e.value<0?"max":e.clamp?"clamp(bottom top-="+n+")":"bottom top-="+n},scroller:H,scrub:!0,refreshPriority:-999,onRefreshInit:i,onRefresh:s,onKill:function _(e){var t=O.indexOf(e);0<=t&&O.splice(t,1),i()},onUpdate:function _(e){var t,r,n,$,o=w+E*(e.progress-v),i=x.length,s=0;if(e.offset){if(i){for(n=-_i,$=e.end;i--;){if((r=x[i]).trig.isActive||n>=r.start&&n<=r.end)return void(p&&(r.trig.progress+=r.trig.direction<0?.001:-.001,r.trig.update(0,0,1),p.resetTo("y",parseFloat(T.y),-_s,!0),_a&&p.progress(1)));n>r.end&&(s+=r.distance),$-=r.distance}o=w+s+E*((a.utils.clamp(e.start,e.end,n)-e.start-s)/($-e.start)-v)}C.length&&!d&&C.forEach(function(_){return _(o-s)}),o=Math.round(1e5*(t=o+y))/1e5||0,p?(p.resetTo("y",o,-_s,!0),_a&&p.progress(1)):(T.y=o+"px",T.renderTransform(1))}}})),a.core.getCache(f.trigger).stRevert=R,f.startY=w,f.pins=x,f.markers=C,f.ratio=l,f.autoSpeed=d,_.style.willChange="transform"),f}l||k.register(a)||console.warn("Please gsap.registerPlugin(ScrollSmoother)"),_=this.vars=_||{},v&&v.kill(),S(v=this);var z,H,N,B,O,I,U,V,W,j,D,M,q,F,Y,K,G=_.smoothTouch,J=_.onUpdate,Q=_.onStop,X=_.smooth,Z=_.onFocusIn,__=_.normalizeScroll,_e=_.wholePixels,_t=this,_r=_.effectsPrefix||"",_n=h.getScrollFunc(c),_$=1===h.isTouch?!0===G?.8:parseFloat(G)||0:0===X||!1===X?0:parseFloat(X)||.8,_o=_$&&+_.speed||1,_i=0,_s=0,_a=1,_l=y(0),_c={y:0},_f="undefined"!=typeof ResizeObserver&&!1!==_.autoResize&&new ResizeObserver(function(){if(!h.isRefreshing){var _=$(H)*_o;_<-_i&&i(_),w.restart(!0)}});function _u(){return N=z.clientHeight,z.style.overflow="visible",d.style.height=c.innerHeight+(N-c.innerHeight)/_o+"px",N-c.innerHeight}E(),h.addEventListener("killAll",E),a.delayedCall(.5,function(){return _a=0}),this.scrollTop=i,this.scrollTo=function(_,t,r){var n=a.utils.clamp(0,$(),isNaN(_)?e.offset(_,r,!!t&&!j):+_);t?j?a.to(e,{duration:_$,scrollTop:n,overwrite:"auto",ease:m}):_n(n):i(n)},this.offset=function(_,e,t){var r,n=(_=p(_)[0]).style.cssText,$=h.create({trigger:_,start:e||"top top"});return O&&(_a?h.refresh():x([$],!0)),r=$.start/(t?_o:1),$.kill(!1),_.style.cssText=n,a.core.getCache(_).uncache=1,r},this.content=function(_){if(arguments.length){var e=p(_||"#smooth-content")[0]||console.warn("ScrollSmoother needs a valid content element.")||d.children[0];return e!==z&&(W=(z=e).getAttribute("style")||"",_f&&_f.observe(z),a.set(z,{overflow:"visible",width:"100%",boxSizing:"border-box",y:"+=0"}),_$||a.set(z,{clearProps:"transform"})),this}return z},this.wrapper=function(_){var e,t;return arguments.length?(V=(H=p(_||"#smooth-wrapper")[0]||(e=z,(t=f.querySelector(".ScrollSmoother-wrapper"))||((t=f.createElement("div")).classList.add("ScrollSmoother-wrapper"),e.parentNode.insertBefore(t,e),t.appendChild(e)),t)).getAttribute("style")||"",_u(),a.set(H,_$?{overflow:"hidden",position:"fixed",height:"100%",width:"100%",top:0,left:0,right:0,bottom:0}:{overflow:"visible",position:"relative",width:"100%",height:"auto",top:"auto",bottom:"auto",left:"auto",right:"auto"}),this):H},this.effects=function(_,e){if(O=O||[],!_)return O.slice(0);(_=p(_)).forEach(function(_){for(var e=O.length;e--;)O[e].trigger===_&&O[e].kill()});var t,r,n=(e=e||{}).speed,$=e.lag,o=e.effectsPadding,i=[];for(t=0;t<_.length;t++)(r=L(_[t],n,$,t,o))&&i.push(r);return O.push.apply(O,i),!1!==e.refresh&&h.refresh(),i},this.sections=function(_,e){if(I=I||[],!_)return I.slice(0);var t=p(_).map(function(_){return h.create({trigger:_,start:"top 120%",end:"bottom -20%",onToggle:function e(t){_.style.opacity=t.isActive?"1":"0",_.style.pointerEvents=t.isActive?"all":"none"}})});return e&&e.add?I.push.apply(I,t):I=t.slice(0),t},this.content(_.content),this.wrapper(_.wrapper),this.render=function(_){return o(_||0===_?_:_i)},this.getVelocity=function(){return _l.getVelocity(-_i)},h.scrollerProxy(H,{scrollTop:i,scrollHeight:function _(){return _u()&&d.scrollHeight},fixedMarkers:!1!==_.fixedMarkers&&!!_$,content:z,getBoundingClientRect:function _(){return{top:0,left:0,width:c.innerWidth,height:c.innerHeight}}}),h.defaults({scroller:H});var _7=h.getAll().filter(function(_){return _.scroller===c||_.scroller===H});_7.forEach(function(_){return _.revert(!0,!0)}),B=h.create({animation:a.fromTo(_c,{y:function _(){return F=0}},{y:function _(){return F=1,-_u()},immediateRender:!1,ease:"none",data:"ScrollSmoother",duration:100,onUpdate:function _(){if(F){var e=Y;e&&(n(B),_c.y=_i),o(_c.y,e),t(),J&&!j&&J(_t)}}}),onRefreshInit:function _(e){if(!k.isRefreshing){if(k.isRefreshing=!0,O){var t=h.getAll().filter(function(_){return!!_.pin});O.forEach(function(_){_.vars.pinnedContainer||t.forEach(function(e){if(e.pin.contains(_.trigger)){var t=_.vars;t.pinnedContainer=e.pin,_.vars=null,_.init(t,_.animation)}})})}var r=e.getTween();q=r&&r._end>r._dp._time,M=_i,_c.y=0,_$&&(1===h.isTouch&&(H.style.position="absolute"),H.scrollTop=0,1===h.isTouch&&(H.style.position="fixed"))}},onRefresh:function _(e){e.animation.invalidate(),e.setPositions(e.start,_u()/_o),q||n(e),_c.y=-_n()*_o,o(_c.y),_a||(q&&(Y=!1),e.animation.progress(a.utils.clamp(0,1,-(M/_o/e.end)))),q&&(e.progress-=.001,e.update()),k.isRefreshing=!1},id:"ScrollSmoother",scroller:c,invalidateOnRefresh:!0,start:0,refreshPriority:-9999,end:function _(){return _u()/_o},onScrubComplete:function _(){_l.reset(),Q&&Q(e)},scrub:_$||!0}),this.smooth=function(e){return arguments.length&&(_o=(_$=e||0)&&+_.speed||1,B.scrubDuration(e)),B.getTween()?B.getTween().duration():0},B.getTween()&&(B.getTween().vars.ease=_.ease||m),this.scrollTrigger=B,_.effects&&this.effects(!0===_.effects?"[data-"+_r+"speed], [data-"+_r+"lag]":_.effects,{effectsPadding:_.effectsPadding,refresh:!1}),_.sections&&this.sections(!0===_.sections?"[data-section]":_.sections),_7.forEach(function(_){_.vars.scroller=H,_.revert(!1,!0),_.init(_.vars,_.animation)}),this.paused=function(_,e){return arguments.length?(!!j!==_&&(_?(B.getTween()&&B.getTween().pause(),_n(-_i/_o),_l.reset(),(D=h.normalizeScroll())&&D.disable(),(j=h.observe({preventDefault:!0,type:"wheel,touch,scroll",debounce:!1,allowClicks:!0,onChangeY:function _(){return i(-_i)}})).nested=b(u,"wheel,touch,scroll",!0,!1!==e)):(j.nested.kill(),j.kill(),j=0,D&&D.enable(),B.progress=(-_i/_o-B.start)/(B.end-B.start),n(B))),this):!!j},this.kill=this.revert=function(){e.paused(!1),n(B),B.kill();for(var _=(O||[]).concat(I||[]),t=_.length;t--;)_[t].kill();h.scrollerProxy(H),h.removeEventListener("killAll",E),h.removeEventListener("refresh",C),H.style.cssText=V,z.style.cssText=W;var r=h.defaults({});r&&r.scroller===H&&h.defaults({scroller:c}),e.normalizer&&h.normalizeScroll(!1),clearInterval(U),v=null,_f&&_f.disconnect(),d.style.removeProperty("height"),c.removeEventListener("focusin",s)},this.refresh=function(_,e){return B.refresh(_,e)},__&&(this.normalizer=h.normalizeScroll(!0===__?{debounce:!0,content:!_$&&z}:__)),h.config(_),"scrollBehavior"in c.getComputedStyle(d)&&a.set([d,u],{scrollBehavior:"auto"}),c.addEventListener("focusin",s),U=setInterval(t,250),"loading"===f.readyState||requestAnimationFrame(function(){return h.refresh()})}P.version="3.12.7",P.create=function(_){return v&&_&&v.content()===p(_.content)[0]?v:new P(_)},P.get=function(){return v},r()&&a.registerPlugin(P),_.ScrollSmoother=P,_.default=P,"undefined"==typeof window||window!==_?Object.defineProperty(_,"__esModule",{value:!0}):delete _.default});