scroll-rise
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -1,2 +0,2 @@ | ||
var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{FK:()=>j,xy:()=>p,y_:()=>W,yz:()=>E,Jj:()=>x,Vi:()=>P,xs:()=>l,sP:()=>o,vJ:()=>r,XC:()=>L,Rp:()=>b,jL:()=>u,nv:()=>f,Zr:()=>n});var i,n=function(){function t(){}return t.castToInt=function(t){return Math.round(t)},t.clientWidth=function(){return document.documentElement.clientWidth},t.clientHeight=function(){return document.documentElement.clientHeight},t.innerWidth=function(){return window.innerWidth},t.innerHeight=function(){return window.innerHeight},t.documentHeight=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},t.windowSizes=function(){return{clientWidth:this.clientWidth(),clientHeight:this.clientHeight(),innerWidth:this.innerWidth(),innerHeight:this.innerHeight(),documentHeight:this.documentHeight()}},t.logWindowSizes=function(){console.log("Window size:"),"undefined"!=typeof document?(console.log("document.documentElement.clientWidth, clientHeight",document.documentElement.clientWidth,document.documentElement.clientHeight),console.log("document.documentElement.scrollWidth, scrollHeight",document.documentElement.scrollWidth,document.documentElement.scrollHeight),console.log("document.body.scrollWidth, scrollHeight",document.body.scrollWidth,document.body.scrollHeight),console.log("document.body.offsetWidth, offsetHeight",document.body.offsetWidth,document.body.offsetHeight),console.log("document.documentElement.offsetWidth, offsetHeight",document.documentElement.offsetWidth,document.documentElement.offsetHeight),console.log("document.body.clientWidth, clientHeight",document.body.clientWidth,document.body.clientHeight)):console.log("document is not defined"),"undefined"!=typeof window?console.log("window.innerWidth, innerHeight",window.innerWidth,window.innerHeight):console.log("window is not defined")},t}(),o=function(){function t(t){this.scene=t,this.initialized=!1,this.ticking=!1,this.saveDisplaySize(),this.init(),this.tick()}return t.prototype.saveDisplaySize=function(){this.displayWidth=n.clientWidth(),this.displayHeight=n.clientHeight()},t.prototype.isNeedResize=function(){return!0},t.prototype.tick=function(){var t=this;this.ticking||(null===window||void 0===window||window.requestAnimationFrame((function(){t.render(t.scene.elementY()),t.ticking=!1})),this.ticking=!0)},t.prototype.pos=function(t){return-(t+this.scene.offset())},t.prototype.scroll=function(){this.tick()},t.prototype.resize=function(){this.isNeedResize()&&(this.scene.resizeHeight(),this.scene.redrawMeasuringGrid(),this.tick())},t.prototype.init=function(){if(this.initialized)throw new Error("Scroll-Rise has already been initialized");this.initialized=!0,this.scrollListener=this.scroll.bind(this),null===window||void 0===window||window.addEventListener("scroll",this.scrollListener),this.resizeListener=this.resize.bind(this),null===window||void 0===window||window.addEventListener("resize",this.resizeListener),this.tick()},t.prototype.stop=function(){if(!this.initialized)throw new Error("Scroll-Rise hasn't yet been initialized");this.initialized=!1,void 0!==this.scrollListener&&(null===window||void 0===window||window.removeEventListener("scroll",this.scrollListener)),void 0!==this.resizeListener&&(null===window||void 0===window||window.removeEventListener("resize",this.resizeListener))},t.prototype.render=function(t){for(var e=0,i=this.scene.actors;e<i.length;e++)i[e].render(this.pos(t),this.scene)},t.version=function(){return"1.6.2"},t}(),r=function(){function t(t,e){this.container=t,this.options=e}return t.prototype.handleScrollReset=function(){scrollY=this.container.scrollTop},t.prototype.exclude=function(t){var e,i,n=this;if(null===(i=null===(e=this.options)||void 0===e?void 0:e.excludeIds)||void 0===i?void 0:i.length)return document.elementsFromPoint(t.clientX,t.clientY).find((function(t){var e,i;return null===(i=null===(e=n.options)||void 0===e?void 0:e.excludeIds)||void 0===i?void 0:i.includes(t.id)}))},t.prototype.handleMouseWheel=function(t){var e,i;if(!this.exclude(t)){t.preventDefault();var n=t.deltaY;if(n=(null===(e=this.options)||void 0===e?void 0:e.deltaY)?n*this.options.deltaY:n,(null===(i=this.options)||void 0===i?void 0:i.limitY)&&Math.abs(n)>this.options.limitY&&(n=n>0?this.options.limitY:-this.options.limitY),scrollY+=n,scrollY>0){var o=this.container.scrollHeight-this.container.clientHeight;scrollY>o&&(scrollY=o)}else scrollY=0;null===window||void 0===window||window.scrollTo(0,scrollY)}},t.prototype.init=function(){this.mouseupListener=this.handleScrollReset.bind(this),this.mousedownListener=this.handleScrollReset.bind(this),this.mousewheelListener=this.handleMouseWheel.bind(this),this.container.addEventListener("mouseup",this.mouseupListener,!1),this.container.addEventListener("mousedown",this.mousedownListener,!1),this.container.addEventListener("mousewheel",this.mousewheelListener,{passive:!1}),this.container.addEventListener("DOMMouseScroll",this.mousewheelListener,{passive:!1}),this.container.addEventListener("wheel",this.mousewheelListener,{passive:!1})},t.prototype.stop=function(){this.mouseupListener&&this.container.removeEventListener("mouseup",this.mouseupListener),this.mousedownListener&&this.container.removeEventListener("mousedown",this.mousedownListener),this.mousewheelListener&&(this.container.removeEventListener("mousewheel",this.mousewheelListener),this.container.removeEventListener("DOMMouseScroll",this.mousewheelListener),this.container.removeEventListener("wheel",this.mousewheelListener))},t}(),s=function(){function t(t,e){this.element=t,this.grid=e,this.elements=[]}return t.prototype.createLabel=function(t,e,i){if(this.grid.label){var n=document.createElement("span");return n.style.position="absolute",n.style.top="".concat(e+this.grid.label.top,"px"),n.style.left="".concat(this.grid.label.left,"px"),n.style.color=i,n.style.fontSize=this.grid.label.fontSize,n.innerText=t.toString(),n}},t.prototype.appendToMeasuringGrid=function(t){this.elements.push(t),this.element.append(t)},t.prototype.createHorizontalLine=function(t,e,i){var n=document.createElement("hr");return n.style.position="absolute",n.style.width="100%",n.style.top="".concat(t,"px"),n.style.margin="0",n.style.border="none",n.style.borderBottom="1px ".concat(e," ").concat(i),n},t.prototype.appendHorizontalGridLines=function(t){for(var e,i,o,r=t.height(n.clientWidth(),n.clientHeight(),this.element.getBoundingClientRect().height),s=this.element.getBoundingClientRect().height/r,c=null!==(i=null===(e=t.label)||void 0===e?void 0:e.startWith)&&void 0!==i?i:0,l=0;l<=s;l++){var h=l*r;if(this.appendToMeasuringGrid(this.createHorizontalLine(h,"solid",t.color)),t.label&&(d=this.createLabel(c,h,t.color))&&(this.appendToMeasuringGrid(d),c+=1),(null===(o=t.subgrid)||void 0===o?void 0:o.height)&&l+1<=s)for(var a=t.subgrid.height(r),u=h+a;u<h+r;){var d;this.appendToMeasuringGrid(this.createHorizontalLine(u,t.subgrid.borderStyle,t.subgrid.color)),t.label&&(d=this.createLabel(c,u,t.color))&&(this.appendToMeasuringGrid(d),c+=1),u+=a}}},t.prototype.createVerticalLine=function(t,e,i){var n=document.createElement("div");return n.style.position="absolute",n.style.left="".concat(t,"px"),n.style.width="0px",n.style.height="100%",n.style.borderLeft="1px ".concat(e," ").concat(i),n.style.top="0",n},t.prototype.appendVerticalSubgridLined=function(t,e,i){for(var n=i.width(e),o=t+n;o<t+e;)this.appendToMeasuringGrid(this.createVerticalLine(o,i.borderStyle,i.color)),o+=n},t.prototype.appendVerticalGridLines=function(t){var e,i,o=t.width(n.clientWidth(),n.clientHeight());(null===(e=t.subgrid)||void 0===e?void 0:e.width)&&this.appendVerticalSubgridLined(0,o,t.subgrid);for(var r=o;r<this.element.getBoundingClientRect().width;)this.appendToMeasuringGrid(this.createVerticalLine(r,"solid",t.color)),(null===(i=t.subgrid)||void 0===i?void 0:i.width)&&this.appendVerticalSubgridLined(r,o,t.subgrid),r+=o},t.prototype.clearMeasuringGrid=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.redrawMeasuringGrid=function(){this.clearMeasuringGrid(),this.grid.height&&this.appendHorizontalGridLines(this.grid),this.grid.width&&this.appendVerticalGridLines(this.grid)},t}(),c=function(){return c=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},c.apply(this,arguments)},l=function(){function t(t,e,i){this.element=t,this.height=e,this.options=i,this._actors=[],this.setDefaults(),this.init(),this.resizeHeight(),this.initMeasuringGrid(),this.redrawMeasuringGrid()}return t.prototype.setDefaults=function(){this.options=c(c({},this.defaults()),this.options)},t.prototype.defaults=function(){return{offset:function(){return 0}}},t.prototype.offset=function(){return this.options.offset(n.clientWidth(),n.clientHeight(),this.elementHeight())},t.prototype.initMeasuringGrid=function(){var t;(null===(t=this.options)||void 0===t?void 0:t.measuringGrid)&&(this.grid=new s(this.element,this.options.measuringGrid))},t.prototype.elementY=function(){return this.element.getBoundingClientRect().y},t.prototype.elementHeight=function(){return this.height(n.clientWidth(),n.clientHeight())},t.prototype.add=function(t){this._actors.push(t)},Object.defineProperty(t.prototype,"actors",{get:function(){return this._actors},enumerable:!1,configurable:!0}),t.prototype.interceptY=function(t,e,i,n){},t.prototype.redrawMeasuringGrid=function(){this.grid&&this.grid.redrawMeasuringGrid()},t}(),h=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return a=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)},u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="StickyPlatformScene",e}return h(e,t),e.prototype.defaults=function(){return a(a({},t.prototype.defaults.call(this)),{stickyPlatformHeight:function(t,e){return e}})},e.prototype.resizeHeight=function(){this.element.style.height="".concat(this.height(n.clientWidth(),n.clientHeight()),"px"),this.resizePlatform()},e.prototype.resizePlatform=function(){this.platform.style.height="".concat(this.options.stickyPlatformHeight(n.clientWidth(),n.clientHeight()),"px")},e.prototype.init=function(){this.element.style.position="relative",this.element.style.overflow="visible",this.platform=document.createElement("div"),this.platform.style.position="sticky",this.platform.style.top="0",this.platform.style.left="0",this.platform.style.width="100%",this.element.appendChild(this.platform)},e.prototype.add=function(e){var i;t.prototype.add.call(this,e),this.element===(null===(i=e.element)||void 0===i?void 0:i.parentElement)&&(this.platform.appendChild(e.element),e.element.style.position="absolute"),e.initElement(this.elementY(),this)},e.prototype.interceptY=function(e,i,n,o){return e<i.getStartPos()?n():e>i.getEndPos()?o():t.prototype.interceptY.call(this,e,i,n,o)},e}(l),d=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="FixedActorsScene",e.platformHeight=n.clientHeight,e}return d(e,t),e.prototype.resizeHeight=function(){this.element.style.height="".concat(this.height(n.clientWidth(),n.clientHeight()),"px")},e.prototype.init=function(){this.element.style.position="relative"},e.prototype.add=function(e){t.prototype.add.call(this,e),e.element.style.position="fixed",e.initElement(this.elementY(),this)},e.prototype.interceptY=function(e,i,n,o){if(e<i.getStartPos())return this.elementY()<0?n():this.elementY()+n();if(e>i.getEndPos()){var r=this.elementHeight()+this.elementY();return r<this.platformHeight()?o()-(this.platformHeight()-r):o()}return t.prototype.interceptY.call(this,e,i,n,o)},e}(l),f=function(){function t(t,e,i){if(void 0===i&&(i=e),this.motion=t,this.start=e,this.end=i,void 0===i)this.end=e;else if(this.getStartPos()>this.getEndPos())throw new SyntaxError('"Start" later than "End" in the frame')}return t.prototype.getStartPos=function(){return this.start(n.clientWidth(),n.clientHeight())},t.prototype.getEndPos=function(){return this.end(n.clientWidth(),n.clientHeight())},t.prototype.length=function(){return this.getEndPos()-this.getStartPos()},t}(),y=function(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},g=function(){function t(){this.frames=[]}return t.prototype.afterBindElement=function(){},t.prototype.groupFramesByMotion=function(t){return t.reduce((function(t,e){var i=e.motion.name;return t[i]=t[i]?y(y([],t[i],!0),[e],!1):[e],t}),{})},t.prototype.render=function(t,e){var i;this.beforeRender&&this.beforeRender();for(var o=this.groupFramesByMotion(this.frames),r=0,s=Object.keys(o);r<s.length;r++)if(o[a=s[r]].length>1){var c=o[a].filter((function(e){return t<e.getStartPos()&&t+n.clientHeight()>=e.getStartPos()||t>=e.getStartPos()&&t+n.clientHeight()<=e.getEndPos()||t>=e.getStartPos()&&t<=e.getEndPos()}));1===c.length?o[a]=c:0===c.length&&o[a].length?(o[a].sort((function(t,e){return t.getStartPos()-e.getStartPos()})),t+n.clientHeight()<o[a][0].getStartPos()?o[a]=[o[a][0]]:(o[a].sort((function(t,e){return t.getEndPos()>e.getEndPos()?-1:t.getEndPos()>e.getEndPos()?0:1})),t>o[a][0].getEndPos()&&(o[a]=[o[a][0]]))):(c.sort((function(t,e){return t.getStartPos()-e.getStartPos()})),o[a]=[c[c.length-1]])}if(this.element)for(var l=0,h=Object.keys(o);l<h.length;l++){var a;(null===(i=o[a=h[l]])||void 0===i?void 0:i.length)&&o[a][0].motion.make(t,o[a][0],this.element,e)}this.afterRender&&this.afterRender()},t.prototype.addFrame=function(t){this.frames.push(t)},t.prototype.addFrames=function(t){this.frames=this.frames.concat(t)},t.prototype.initElement=function(t,e){this.element=this.bindElement(t,e),this.afterBindElement()},t}(),m=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return m(e,t),e.prototype.findFirstFrame=function(t){return this.frames.reduce((function(e,i){return i.motion.name===t?e?i.getStartPos()<(null==e?void 0:e.getStartPos())?i:e:i:e||void 0}),void 0)},e.prototype.findFirstMoveMotionFrame=function(){var t=this.findFirstFrame("MoveMotion");if(t)return t;throw new Error('First "MoveMotion" frame wasn\'t found')},e.prototype.calcStartSize=function(){var t=this.findFirstFrame("SizeMotion");if(t){var e=t.motion;return{width:e.startWidth,height:e.startHeight}}throw new Error('First "SizeMotion" frame wasn\'t found')},e.prototype.calcStartOpacity=function(){var t=this.findFirstFrame("OpacityMotion");if(t)return t.motion.start;throw new Error('First "OpacityMotion" frame wasn\'t found')},e.prototype.bindElement=function(t,e){return this.element},e}(g),w=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),H=function(){return H=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},H.apply(this,arguments)},b=function(t){function e(e,i){var n=t.call(this)||this;return n.element=e,n.options=i,n.options=H({initPosition:!0,initSize:!0,initOpacity:!0},n.options),n}return w(e,t),e.prototype.bindElement=function(t,e){var i,o,r;if(this.element){if(null===(i=this.options)||void 0===i?void 0:i.initPosition){var s=this.findFirstMoveMotionFrame();s.motion.make(t,s,this.element,e)}if(null===(o=this.options)||void 0===o?void 0:o.initSize){var c=this.calcStartSize();this.element.style.width="".concat(c.width(n.clientWidth(),n.clientHeight()),"px"),this.element.style.height="".concat(c.height(n.clientWidth(),n.clientHeight()),"px")}if(null===(r=this.options)||void 0===r?void 0:r.initOpacity){var l=this.calcStartOpacity();this.element.style.opacity="".concat(l(n.clientWidth(),n.clientHeight()))}}return this.element},e}(v),S=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),P=function(t){function e(e){var i=t.call(this)||this;return i.element=e,i}return S(e,t),e.prototype.bindElement=function(){return this.element},e}(v),W=function(){function t(){}return t.prototype.motionName=function(){return this.name},t}(),_=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),E=function(t){function e(e){var i=t.call(this)||this;return i.name="MoveMotion",i.startX=e.startX,i.endX=e.endX,i.startY=e.startY,i.endY=e.endY,i}return _(e,t),e.prototype.renderX=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.left="".concat(this.startX(n.clientWidth(),n.clientHeight()),"px"));if(t>e.getEndPos())return void(i.style.left="".concat(this.endX(n.clientWidth(),n.clientHeight()),"px"));var o=(this.endX(n.clientWidth(),n.clientHeight())-this.startX(n.clientWidth(),n.clientHeight()))/e.length(),r=n.castToInt(this.startX(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos()));i.style.left="".concat(r,"px")}},e.prototype.renderY=function(t,e,i,o){var r=this,s=function(){return r.startY(n.clientWidth(),n.clientHeight())},c=function(){return r.endY(n.clientWidth(),n.clientHeight())};if(i){var l=(c()-s())/e.length(),h=n.castToInt(s()+l*(t-e.getStartPos())),a=o.interceptY(t,e,s,c);void 0!==a&&(h=a),i.style.top="".concat(h,"px")}},e.prototype.make=function(t,e,i,n){this.renderX(t,e,i),this.renderY(t,e,i,n)},e}(W),O=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),L=function(t){function e(e){var i=t.call(this)||this;return i.name="SizeMotion",i.startWidth=e.startWidth,i.endWidth=e.endWidth,i.startHeight=e.startHeight,i.endHeight=e.endHeight,i}return O(e,t),e.prototype.renderWidth=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.width="".concat(this.startWidth(n.clientWidth(),n.clientHeight()),"px"));if(t>e.getEndPos())return void(i.style.width="".concat(this.endWidth(n.clientWidth(),n.clientHeight()),"px"));var o=(this.endWidth(n.clientWidth(),n.clientHeight())-this.startWidth(n.clientWidth(),n.clientHeight()))/e.length(),r=this.startWidth(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos());i.style.width="".concat(r,"px")}},e.prototype.renderHeight=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.height="".concat(this.startHeight(n.clientWidth(),n.clientHeight()),"px"));if(t>e.getEndPos())return void(i.style.height="".concat(this.endHeight(n.clientWidth(),n.clientHeight()),"px"));var o=(this.endHeight(n.clientWidth(),n.clientHeight())-this.startHeight(n.clientWidth(),n.clientHeight()))/e.length(),r=this.startHeight(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos());i.style.height="".concat(r,"px")}},e.prototype.make=function(t,e,i){this.renderWidth(t,e,i),this.renderHeight(t,e,i)},e}(W),M=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),x=function(t){function e(e){var i=t.call(this)||this;return i.name="OpacityMotion",i.start=e.start,i.end=e.end,i}return M(e,t),e.prototype.renderOpacity=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.opacity=this.start(n.clientWidth(),n.clientHeight()).toString());if(t>e.getEndPos())return void(i.style.opacity=this.end(n.clientWidth(),n.clientHeight()).toString());var o=(this.end(n.clientWidth(),n.clientHeight())-this.start(n.clientWidth(),n.clientHeight()))/e.length(),r=this.start(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos());i.style.opacity=r.toString()}},e.prototype.make=function(t,e,i){this.renderOpacity(t,e,i)},e}(W),z=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),j=function(t){function e(e){var i=t.call(this)||this;return i.name="BoundMotion",i.before=e.before,i.after=e.after,i}return z(e,t),e.prototype.applyProperties=function(t,e){for(var i=0,n=Object.keys(e);i<n.length;i++){var o=n[i];t.style[o]=e[o]}},e.prototype.make=function(t,e,i){i&&(t<e.getStartPos()?this.applyProperties(i,this.before(n.clientWidth(),n.clientHeight())):this.applyProperties(i,this.after(n.clientWidth(),n.clientHeight())))},e}(W),Y=e.FK,F=e.xy,k=e.y_,T=e.yz,G=e.Jj,R=e.Vi,C=e.xs,A=e.sP,X=e.vJ,B=e.XC,V=e.Rp,D=e.jL,I=e.nv,J=e.Zr;export{Y as BoundMotion,F as FixedActorsScene,k as Motion,T as MoveMotion,G as OpacityMotion,R as RefActor,C as Scene,A as ScrollRise,X as ScrollRiseSpeed,B as SizeMotion,V as StaticActor,D as StickyPlatformScene,I as TimeFrame,J as Util}; | ||
var t={d:(e,i)=>{for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{FK:()=>j,xy:()=>p,y_:()=>W,yz:()=>E,Jj:()=>x,Vi:()=>P,xs:()=>l,sP:()=>o,vJ:()=>r,XC:()=>L,Rp:()=>b,jL:()=>u,nv:()=>f,Zr:()=>n});var i,n=function(){function t(){}return t.castToInt=function(t){return Math.round(t)},t.clientWidth=function(){return document.documentElement.clientWidth},t.clientHeight=function(){return document.documentElement.clientHeight},t.innerWidth=function(){return window.innerWidth},t.innerHeight=function(){return window.innerHeight},t.documentHeight=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},t.windowSizes=function(){return{clientWidth:this.clientWidth(),clientHeight:this.clientHeight(),innerWidth:this.innerWidth(),innerHeight:this.innerHeight(),documentHeight:this.documentHeight()}},t.logWindowSizes=function(){console.log("Window size:"),"undefined"!=typeof document?(console.log("document.documentElement.clientWidth, clientHeight",document.documentElement.clientWidth,document.documentElement.clientHeight),console.log("document.documentElement.scrollWidth, scrollHeight",document.documentElement.scrollWidth,document.documentElement.scrollHeight),console.log("document.body.scrollWidth, scrollHeight",document.body.scrollWidth,document.body.scrollHeight),console.log("document.body.offsetWidth, offsetHeight",document.body.offsetWidth,document.body.offsetHeight),console.log("document.documentElement.offsetWidth, offsetHeight",document.documentElement.offsetWidth,document.documentElement.offsetHeight),console.log("document.body.clientWidth, clientHeight",document.body.clientWidth,document.body.clientHeight)):console.log("document is not defined"),"undefined"!=typeof window?console.log("window.innerWidth, innerHeight",window.innerWidth,window.innerHeight):console.log("window is not defined")},t}(),o=function(){function t(t){this.scene=t,this.initialized=!1,this.ticking=!1,this.saveDisplaySize(),this.init(),this.tick()}return t.prototype.saveDisplaySize=function(){this.displayWidth=n.clientWidth(),this.displayHeight=n.clientHeight()},t.prototype.isNeedResize=function(){return!0},t.prototype.tick=function(){var t=this;this.ticking||(null===window||void 0===window||window.requestAnimationFrame((function(){t.render(t.scene.elementY()),t.ticking=!1})),this.ticking=!0)},t.prototype.pos=function(t){return-(t+this.scene.offset())},t.prototype.scroll=function(){this.tick()},t.prototype.resize=function(){this.isNeedResize()&&(this.scene.resizeHeight(),this.scene.redrawMeasuringGrid(),this.tick())},t.prototype.init=function(){if(this.initialized)throw new Error("Scroll-Rise has already been initialized");this.initialized=!0,this.scrollListener=this.scroll.bind(this),null===window||void 0===window||window.addEventListener("scroll",this.scrollListener),this.resizeListener=this.resize.bind(this),null===window||void 0===window||window.addEventListener("resize",this.resizeListener),this.tick()},t.prototype.stop=function(){if(!this.initialized)throw new Error("Scroll-Rise hasn't yet been initialized");this.initialized=!1,void 0!==this.scrollListener&&(null===window||void 0===window||window.removeEventListener("scroll",this.scrollListener)),void 0!==this.resizeListener&&(null===window||void 0===window||window.removeEventListener("resize",this.resizeListener))},t.prototype.render=function(t){for(var e=0,i=this.scene.actors;e<i.length;e++)i[e].render(this.pos(t),this.scene)},t.version=function(){return"1.6.3"},t}(),r=function(){function t(t,e){this.container=t,this.options=e}return t.prototype.handleScrollReset=function(){scrollY=this.container.scrollTop},t.prototype.exclude=function(t){var e,i,n=this;if(null===(i=null===(e=this.options)||void 0===e?void 0:e.excludeIds)||void 0===i?void 0:i.length)return document.elementsFromPoint(t.clientX,t.clientY).find((function(t){var e,i;return null===(i=null===(e=n.options)||void 0===e?void 0:e.excludeIds)||void 0===i?void 0:i.includes(t.id)}))},t.prototype.handleMouseWheel=function(t){var e,i;if(!this.exclude(t)){t.preventDefault();var n=t.deltaY;if(n=(null===(e=this.options)||void 0===e?void 0:e.deltaY)?n*this.options.deltaY:n,(null===(i=this.options)||void 0===i?void 0:i.limitY)&&Math.abs(n)>this.options.limitY&&(n=n>0?this.options.limitY:-this.options.limitY),scrollY+=n,scrollY>0){var o=this.container.scrollHeight-this.container.clientHeight;scrollY>o&&(scrollY=o)}else scrollY=0;null===window||void 0===window||window.scrollTo(0,scrollY)}},t.prototype.init=function(){this.mouseupListener=this.handleScrollReset.bind(this),this.mousedownListener=this.handleScrollReset.bind(this),this.mousewheelListener=this.handleMouseWheel.bind(this),this.container.addEventListener("mouseup",this.mouseupListener,!1),this.container.addEventListener("mousedown",this.mousedownListener,!1),this.container.addEventListener("mousewheel",this.mousewheelListener,{passive:!1}),this.container.addEventListener("DOMMouseScroll",this.mousewheelListener,{passive:!1}),this.container.addEventListener("wheel",this.mousewheelListener,{passive:!1})},t.prototype.stop=function(){this.mouseupListener&&this.container.removeEventListener("mouseup",this.mouseupListener),this.mousedownListener&&this.container.removeEventListener("mousedown",this.mousedownListener),this.mousewheelListener&&(this.container.removeEventListener("mousewheel",this.mousewheelListener),this.container.removeEventListener("DOMMouseScroll",this.mousewheelListener),this.container.removeEventListener("wheel",this.mousewheelListener))},t}(),s=function(){function t(t,e){this.element=t,this.grid=e,this.elements=[]}return t.prototype.createLabel=function(t,e,i){if(this.grid.label){var n=document.createElement("span");return n.style.position="absolute",n.style.top="".concat(e+this.grid.label.top,"px"),n.style.left="".concat(this.grid.label.left,"px"),n.style.color=i,n.style.fontSize=this.grid.label.fontSize,n.innerText=t.toString(),n}},t.prototype.appendToMeasuringGrid=function(t){this.elements.push(t),this.element.append(t)},t.prototype.createHorizontalLine=function(t,e,i){var n=document.createElement("hr");return n.style.position="absolute",n.style.width="100%",n.style.top="".concat(t,"px"),n.style.margin="0",n.style.border="none",n.style.borderBottom="1px ".concat(e," ").concat(i),n},t.prototype.appendHorizontalGridLines=function(t){for(var e,i,o,r=t.height(n.clientWidth(),n.clientHeight(),this.element.getBoundingClientRect().height),s=this.element.getBoundingClientRect().height/r,c=null!==(i=null===(e=t.label)||void 0===e?void 0:e.startWith)&&void 0!==i?i:0,l=0;l<=s;l++){var h=l*r;if(this.appendToMeasuringGrid(this.createHorizontalLine(h,"solid",t.color)),t.label&&(d=this.createLabel(c,h,t.color))&&(this.appendToMeasuringGrid(d),c+=1),(null===(o=t.subgrid)||void 0===o?void 0:o.height)&&l+1<=s)for(var a=t.subgrid.height(r),u=h+a;u<h+r;){var d;this.appendToMeasuringGrid(this.createHorizontalLine(u,t.subgrid.borderStyle,t.subgrid.color)),t.label&&(d=this.createLabel(c,u,t.color))&&(this.appendToMeasuringGrid(d),c+=1),u+=a}}},t.prototype.createVerticalLine=function(t,e,i){var n=document.createElement("div");return n.style.position="absolute",n.style.left="".concat(t,"px"),n.style.width="0px",n.style.height="100%",n.style.borderLeft="1px ".concat(e," ").concat(i),n.style.top="0",n},t.prototype.appendVerticalSubgridLined=function(t,e,i){for(var n=i.width(e),o=t+n;o<t+e;)this.appendToMeasuringGrid(this.createVerticalLine(o,i.borderStyle,i.color)),o+=n},t.prototype.appendVerticalGridLines=function(t){var e,i,o=t.width(n.clientWidth(),n.clientHeight());(null===(e=t.subgrid)||void 0===e?void 0:e.width)&&this.appendVerticalSubgridLined(0,o,t.subgrid);for(var r=o;r<this.element.getBoundingClientRect().width;)this.appendToMeasuringGrid(this.createVerticalLine(r,"solid",t.color)),(null===(i=t.subgrid)||void 0===i?void 0:i.width)&&this.appendVerticalSubgridLined(r,o,t.subgrid),r+=o},t.prototype.clearMeasuringGrid=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.redrawMeasuringGrid=function(){this.clearMeasuringGrid(),this.grid.height&&this.appendHorizontalGridLines(this.grid),this.grid.width&&this.appendVerticalGridLines(this.grid)},t}(),c=function(){return c=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},c.apply(this,arguments)},l=function(){function t(t,e,i){this.element=t,this.height=e,this.options=i,this._actors=[],this.setDefaults(),this.init(),this.resizeHeight(),this.initMeasuringGrid(),this.redrawMeasuringGrid()}return t.prototype.setDefaults=function(){this.options=c(c({},this.defaults()),this.options)},t.prototype.defaults=function(){return{offset:function(){return 0}}},t.prototype.offset=function(){return this.options.offset(n.clientWidth(),n.clientHeight(),this.elementHeight())},t.prototype.initMeasuringGrid=function(){var t;(null===(t=this.options)||void 0===t?void 0:t.measuringGrid)&&(this.grid=new s(this.element,this.options.measuringGrid))},t.prototype.elementY=function(){return this.element.getBoundingClientRect().y},t.prototype.elementHeight=function(){return this.height(n.clientWidth(),n.clientHeight())},t.prototype.add=function(t){this._actors.push(t)},Object.defineProperty(t.prototype,"actors",{get:function(){return this._actors},enumerable:!1,configurable:!0}),t.prototype.interceptY=function(t,e,i,n){},t.prototype.redrawMeasuringGrid=function(){this.grid&&this.grid.redrawMeasuringGrid()},t}(),h=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},i(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return a=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)},u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="StickyPlatformScene",e}return h(e,t),e.prototype.defaults=function(){return a(a({},t.prototype.defaults.call(this)),{stickyPlatformHeight:function(t,e){return e}})},e.prototype.resizeHeight=function(){this.element.style.height="".concat(this.height(n.clientWidth(),n.clientHeight()),"px"),this.resizePlatform()},e.prototype.resizePlatform=function(){this.platform.style.height="".concat(this.options.stickyPlatformHeight(n.clientWidth(),n.clientHeight()),"px")},e.prototype.init=function(){this.element.style.position="relative",this.element.style.overflow="visible",this.platform=document.createElement("div"),this.platform.style.position="sticky",this.platform.style.top="0",this.platform.style.left="0",this.platform.style.width="100%",this.element.appendChild(this.platform)},e.prototype.add=function(e){var i;t.prototype.add.call(this,e),this.element===(null===(i=e.element)||void 0===i?void 0:i.parentElement)&&(this.platform.appendChild(e.element),e.element.style.position="absolute"),e.initElement(this.elementY(),this)},e.prototype.interceptY=function(e,i,n,o){return e<i.getStartPos()?n():e>i.getEndPos()?o():t.prototype.interceptY.call(this,e,i,n,o)},e}(l),d=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="FixedActorsScene",e.platformHeight=n.clientHeight,e}return d(e,t),e.prototype.resizeHeight=function(){this.element.style.height="".concat(this.height(n.clientWidth(),n.clientHeight()),"px")},e.prototype.init=function(){this.element.style.position="relative"},e.prototype.add=function(e){t.prototype.add.call(this,e),e.element.style.position="fixed",e.initElement(this.elementY(),this)},e.prototype.interceptY=function(e,i,n,o){if(e<i.getStartPos())return this.elementY()<0?n():this.elementY()+n();if(e>i.getEndPos()){var r=this.elementHeight()+this.elementY();return r<this.platformHeight()?o()-(this.platformHeight()-r):o()}return t.prototype.interceptY.call(this,e,i,n,o)},e}(l),f=function(){function t(t,e,i){if(void 0===i&&(i=e),this.motion=t,this.start=e,this.end=i,void 0===i)this.end=e;else if(this.getStartPos()>this.getEndPos())throw new SyntaxError('"Start" later than "End" in the frame')}return t.prototype.getStartPos=function(){return this.start(n.clientWidth(),n.clientHeight())},t.prototype.getEndPos=function(){return this.end(n.clientWidth(),n.clientHeight())},t.prototype.length=function(){return this.getEndPos()-this.getStartPos()},t}(),y=function(t,e,i){if(i||2===arguments.length)for(var n,o=0,r=e.length;o<r;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},g=function(){function t(){this.frames=[]}return t.prototype.afterBindElement=function(){},t.prototype.groupFramesByMotion=function(t){return t.reduce((function(t,e){var i=e.motion.name;return t[i]=t[i]?y(y([],t[i],!0),[e],!1):[e],t}),{})},t.prototype.render=function(t,e){var i;this.beforeRender&&this.beforeRender();for(var o=this.groupFramesByMotion(this.frames),r=0,s=Object.keys(o);r<s.length;r++)if(o[a=s[r]].length>1){var c=o[a].filter((function(e){return t<e.getStartPos()&&t+n.clientHeight()>=e.getStartPos()||t>=e.getStartPos()&&t+n.clientHeight()<=e.getEndPos()||t>=e.getStartPos()&&t<=e.getEndPos()}));1===c.length?o[a]=c:0===c.length&&o[a].length?(o[a].sort((function(t,e){return t.getStartPos()-e.getStartPos()})),t+n.clientHeight()<o[a][0].getStartPos()?o[a]=[o[a][0]]:(o[a].sort((function(t,e){return t.getEndPos()>e.getEndPos()?-1:t.getEndPos()>e.getEndPos()?0:1})),t>o[a][0].getEndPos()&&(o[a]=[o[a][0]]))):(c.sort((function(t,e){return t.getStartPos()-e.getStartPos()})),o[a]=[c[c.length-1]])}if(this.element)for(var l=0,h=Object.keys(o);l<h.length;l++){var a;(null===(i=o[a=h[l]])||void 0===i?void 0:i.length)&&o[a][0].motion.make(t,o[a][0],this.element,e)}this.afterRender&&this.afterRender()},t.prototype.addFrame=function(t){this.frames.push(t)},t.prototype.addFrames=function(t){this.frames=this.frames.concat(t)},t.prototype.initElement=function(t,e){this.element=this.bindElement(t,e),this.afterBindElement()},t}(),m=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return m(e,t),e.prototype.findFirstFrame=function(t){return this.frames.reduce((function(e,i){return i.motion.name===t?e?i.getStartPos()<(null==e?void 0:e.getStartPos())?i:e:i:e||void 0}),void 0)},e.prototype.findFirstMoveMotionFrame=function(){var t=this.findFirstFrame("MoveMotion");if(t)return t;throw new Error('First "MoveMotion" frame wasn\'t found')},e.prototype.calcStartSize=function(){var t=this.findFirstFrame("SizeMotion");if(t){var e=t.motion;return{width:e.startWidth,height:e.startHeight}}throw new Error('First "SizeMotion" frame wasn\'t found')},e.prototype.calcStartOpacity=function(){var t=this.findFirstFrame("OpacityMotion");if(t)return t.motion.start;throw new Error('First "OpacityMotion" frame wasn\'t found')},e.prototype.bindElement=function(t,e){return this.element},e}(g),w=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),H=function(){return H=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},H.apply(this,arguments)},b=function(t){function e(e,i){var n=t.call(this)||this;return n.element=e,n.options=i,n.options=H({initPosition:!0,initSize:!0,initOpacity:!0},n.options),n}return w(e,t),e.prototype.bindElement=function(t,e){var i,o,r;if(this.element){if(null===(i=this.options)||void 0===i?void 0:i.initPosition){var s=this.findFirstMoveMotionFrame();s.motion.make(t,s,this.element,e)}if(null===(o=this.options)||void 0===o?void 0:o.initSize){var c=this.calcStartSize();this.element.style.width="".concat(c.width(n.clientWidth(),n.clientHeight()),"px"),this.element.style.height="".concat(c.height(n.clientWidth(),n.clientHeight()),"px")}if(null===(r=this.options)||void 0===r?void 0:r.initOpacity){var l=this.calcStartOpacity();this.element.style.opacity="".concat(l(n.clientWidth(),n.clientHeight()))}}return this.element},e}(v),S=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),P=function(t){function e(e){var i=t.call(this)||this;return i.element=e,i}return S(e,t),e.prototype.bindElement=function(){return this.element},e}(v),W=function(){function t(){}return t.prototype.motionName=function(){return this.name},t}(),_=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),E=function(t){function e(e){var i=t.call(this)||this;return i.name="MoveMotion",i.startX=e.startX,i.endX=e.endX,i.startY=e.startY,i.endY=e.endY,i}return _(e,t),e.prototype.renderX=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.left="".concat(this.startX(n.clientWidth(),n.clientHeight()),"px"));if(t>e.getEndPos())return void(i.style.left="".concat(this.endX(n.clientWidth(),n.clientHeight()),"px"));var o=(this.endX(n.clientWidth(),n.clientHeight())-this.startX(n.clientWidth(),n.clientHeight()))/e.length(),r=n.castToInt(this.startX(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos()));i.style.left="".concat(r,"px")}},e.prototype.renderY=function(t,e,i,o){var r=this,s=function(){return r.startY(n.clientWidth(),n.clientHeight())},c=function(){return r.endY(n.clientWidth(),n.clientHeight())};if(i){var l=(c()-s())/e.length(),h=n.castToInt(s()+l*(t-e.getStartPos())),a=o.interceptY(t,e,s,c);void 0!==a&&(h=a),i.style.top="".concat(h,"px")}},e.prototype.make=function(t,e,i,n){this.renderX(t,e,i),this.renderY(t,e,i,n)},e}(W),O=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),L=function(t){function e(e){var i=t.call(this)||this;return i.name="SizeMotion",i.startWidth=e.startWidth,i.endWidth=e.endWidth,i.startHeight=e.startHeight,i.endHeight=e.endHeight,i}return O(e,t),e.prototype.renderWidth=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.width="".concat(this.startWidth(n.clientWidth(),n.clientHeight()),"px"));if(t>e.getEndPos())return void(i.style.width="".concat(this.endWidth(n.clientWidth(),n.clientHeight()),"px"));var o=(this.endWidth(n.clientWidth(),n.clientHeight())-this.startWidth(n.clientWidth(),n.clientHeight()))/e.length(),r=this.startWidth(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos());i.style.width="".concat(r,"px")}},e.prototype.renderHeight=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.height="".concat(this.startHeight(n.clientWidth(),n.clientHeight()),"px"));if(t>e.getEndPos())return void(i.style.height="".concat(this.endHeight(n.clientWidth(),n.clientHeight()),"px"));var o=(this.endHeight(n.clientWidth(),n.clientHeight())-this.startHeight(n.clientWidth(),n.clientHeight()))/e.length(),r=this.startHeight(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos());i.style.height="".concat(r,"px")}},e.prototype.make=function(t,e,i){this.renderWidth(t,e,i),this.renderHeight(t,e,i)},e}(W),M=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),x=function(t){function e(e){var i=t.call(this)||this;return i.name="OpacityMotion",i.start=e.start,i.end=e.end,i}return M(e,t),e.prototype.renderOpacity=function(t,e,i){if(i){if(t<e.getStartPos())return void(i.style.opacity=this.start(n.clientWidth(),n.clientHeight()).toString());if(t>e.getEndPos())return void(i.style.opacity=this.end(n.clientWidth(),n.clientHeight()).toString());var o=(this.end(n.clientWidth(),n.clientHeight())-this.start(n.clientWidth(),n.clientHeight()))/e.length(),r=this.start(n.clientWidth(),n.clientHeight())+o*(t-e.getStartPos());i.style.opacity=r.toString()}},e.prototype.make=function(t,e,i){this.renderOpacity(t,e,i)},e}(W),z=function(){var t=function(e,i){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},t(e,i)};return function(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),j=function(t){function e(e){var i=t.call(this)||this;return i.name="BoundMotion",i.before=e.before,i.after=e.after,i}return z(e,t),e.prototype.applyProperties=function(t,e){for(var i=0,n=Object.keys(e);i<n.length;i++){var o=n[i];t.style[o]=e[o]}},e.prototype.make=function(t,e,i){i&&(t<e.getStartPos()?this.applyProperties(i,this.before(n.clientWidth(),n.clientHeight())):this.applyProperties(i,this.after(n.clientWidth(),n.clientHeight())))},e}(W),Y=e.FK,F=e.xy,k=e.y_,T=e.yz,G=e.Jj,R=e.Vi,C=e.xs,A=e.sP,X=e.vJ,B=e.XC,V=e.Rp,D=e.jL,I=e.nv,J=e.Zr;export{Y as BoundMotion,F as FixedActorsScene,k as Motion,T as MoveMotion,G as OpacityMotion,R as RefActor,C as Scene,A as ScrollRise,X as ScrollRiseSpeed,B as SizeMotion,V as StaticActor,D as StickyPlatformScene,I as TimeFrame,J as Util}; | ||
//# sourceMappingURL=index.es.js.map |
{ | ||
"name": "scroll-rise", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "The typescript library for scroll animation", |
@@ -8,3 +8,3 @@ # Scroll Rise | ||
[https://drkaramazin.github.io/scroll-rise/](https://drkaramazin.github.io/scroll-rise/) | ||
[Click here to see all the examples](https://drkaramazin.github.io/scroll-rise.site/) | ||
@@ -25,3 +25,3 @@ ## Module System Types | ||
``` | ||
Here is [an example](https://drkaramazin.github.io/scroll-rise/fixed-actors-scene-demo.html) of using this method. | ||
Here is [an example](https://drkaramazin.github.io/scroll-rise.site/fixed-actors-scene-demo.html) of using this method. | ||
@@ -35,3 +35,3 @@ - StickyPlatformScene | ||
``` | ||
This method also has an _offset_ and _stickyPlatformHeight_ options. To see an example of using these options [click here](https://drkaramazin.github.io/scroll-rise/sticky-platform-scene-demo.html). | ||
This method also has an _offset_ and _stickyPlatformHeight_ options. To see an example of using these options [click here](https://drkaramazin.github.io/scroll-rise.site/sticky-platform-scene-demo.html). | ||
@@ -58,3 +58,3 @@ ## Motions | ||
## Authors | ||
## Author | ||
- **Nikolay Grishkin** - Initial work - [GitHub](https://github.com/drKaramazin) | ||
@@ -61,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
97932
0