text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Scrollimation=e()}(this,(function(){"use strict";var t=function(){},e={scrollTop:{configurable:!0},scrollLeft:{configurable:!0}};t.run=function(){t.instances.forEach((function(t){"requestAnimationFrame"===t.mode&&t._handler()})),window.requestAnimationFrame(t.run)},t.addInstance=function(e){var n=function(n){if(void 0===n&&(n=!1),"play"===e.status||n){var o=e.scrollContainer instanceof window.Element?e.scrollContainer.scrollTop:t.scrollTop,i=e.scrollContainer instanceof window.Element?e.scrollContainer.scrollLeft:t.scrollLeft;t.animate(o,i,e,n)}};e.fpsLimit?e._handler=t.Throttle(n,1e3/e.fpsLimit):e._handler=n,"onscroll"===e.mode&&e.scrollContainer.addEventListener("scroll",e._handler),t.instances.push(e),n(!0)},t.removeInstance=function(e){t.instances=t.instances.filter((function(t){return t.id!==e.id}))},t.animate=function(t,e,n,o){void 0===o&&(o=!1),n.scrollTop=t,n.scrollLeft=e;var i="top"===n.direction?t:e;i>=n.from&&!n.startEmitted?("top"===n.direction?n.scrollTop=n.from:n.scrollLeft=n.from,n.startEmitted=!0,n.start(n),n.step(n)):i<=n.from&&n.startEmitted&&("top"===n.direction?n.scrollTop=n.from:n.scrollLeft=n.from,n.startEmitted=!1,n.step(n),n.reverseEnd(n)),i>=n.to&&!n.endEmitted?("top"===n.direction?n.scrollTop=n.to:n.scrollLeft=n.to,n.endEmitted=!0,n.step(n),n.end(n)):i<=n.to&&n.endEmitted&&("top"===n.direction?n.scrollTop=n.to:n.scrollLeft=n.to,n.endEmitted=!1,n.reverseStart(n),n.step(n)),(i>n.from&&i<n.to||o)&&n.step(n)},t.Throttle=function(t,e){var n,o,i=!1;return function r(){if(i)return n=arguments,void(o=this);t.apply(this,arguments),i=!0,setTimeout((function(){i=!1,n&&(r.apply(o,n),n=o=null)}),e)}},e.scrollTop.get=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop},e.scrollLeft.get=function(){return window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft},Object.defineProperties(t,e),t.instances=[],t.run();var n=function(e){this.id=Math.random().toString(36).substr(2,9),this.scrollContainer="string"==typeof e.scrollContainer?document.querySelector(e.scrollContainer):e.scrollContainer||window,this.from=e.from||0,this.to=e.to||0,this.direction=e.direction||"top",this.mode=e.mode||"requestAnimationFrame",this.fpsLimit=e.fpsLimit,this.init=e.init||function(){},this.step=e.step||function(){},this.start=e.start||function(){},this.end=e.end||function(){},this.reverseStart=e.reverseStart||function(){},this.reverseEnd=e.reverseEnd||function(){},this.startEmitted=!1,this.endEmitted=!1,e.target instanceof window.NodeList?this.target=[].slice.call(e.target):"string"==typeof e.target?this.target=[].slice.call(document.querySelectorAll(e.target)):this.target=e.target,this.easing=e.easing||"linear",this.scrollTop=this.scrollContainer instanceof window.Element?this.scrollContainer.scrollTop:t.scrollTop,this.scrollLeft=this.scrollContainer instanceof window.Element?this.scrollContainer.scrollLeft:t.scrollLeft,this.status="play",t.addInstance(this),this.init(this)},o={Easing:{configurable:!0}};return n.prototype.calc=function(t,e,o){var i=this;void 0===o&&(o=this.easing);var r=/(^#[0-9A-F]{3}$)|(^#[0-9A-F]{4}$)|(^#[0-9A-F]{6}$)|(^#[0-9A-F]{8}$)/i;if("string"==typeof t&&r.test(t)&&"string"==typeof e&&r.test(e)){var s=[],a=n.HexToNums(t),l=n.HexToNums(e);return a.forEach((function(t,e){s.push(n.Calculate("top"===i.direction?i.scrollTop:i.scrollLeft,i.from,i.to,t,l[e],"function"==typeof o?o:n.Easing[o]||n.Easing.linear))})),"rgba("+s[0]+", "+s[1]+", "+s[2]+", "+s[3]+")"}return n.Calculate("top"===this.direction?this.scrollTop:this.scrollLeft,this.from,this.to,+t,+e,"function"==typeof o?o:n.Easing[o]||n.Easing.linear)},n.prototype.stop=function(){this.status="pause"},n.prototype.play=function(){this.status="play"},n.prototype.remove=function(){this.status="pause","onscroll"===this.mode&&this.scrollContainer.removeEventListener("scroll",this._handler),t.removeInstance(this)},o.Easing.get=function(){return{linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:(4-2*t)*t-1},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t}}},n.Calculate=function(t,e,n,o,i,r){return void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=function(t){return t}),o+(i-o)*r(((t=(t=t<e?e:t)>n?n:t)-e)/(n-e))},n.HexToNums=function(t){var e;if(4===t.length)e=t.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i).slice(1,4).map((function(t){return 17*parseInt(t,16)}));else if(5===t.length){e=t.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])$/i).slice(1,5).map((function(t){return 17*parseInt(t,16)}))}else if(7===t.length){e=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i).slice(1,4).map((function(t){return parseInt(t,16)}))}else if(9===t.length){e=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i).slice(1,5).map((function(t){return parseInt(t,16)}))}return e[3]=e[3]/255||1,e},Object.defineProperties(n,o),n}));
  //# sourceMappingURL=scrollimation.umd.js.map
  