scroll-rise
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["scroll-rise"]=e():t["scroll-rise"]=e()}(self,(function(){return(()=>{"use strict";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),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Frame:()=>H,MoveMotion:()=>u,OpacityMotion:()=>_,RefWidget:()=>m,SRCanvas:()=>a,ScrollRise:()=>n,ScrollRiseSpeed:()=>o,SizeMotion:()=>S,StaticWidget:()=>g});var i,n=function(){function t(t){this.canvas=t,this.ticking=!1,this.init(),this.tick()}return t.prototype.tick=function(){var t=this;this.ticking||(null===window||void 0===window||window.requestAnimationFrame((function(){t.render(t.canvas.elementY()),t.ticking=!1})),this.ticking=!0)},t.prototype.scroll=function(){this.tick()},t.prototype.resize=function(){this.canvas.init(),this.tick()},t.prototype.init=function(){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)},t.prototype.stop=function(){this.scrollListener&&(null===window||void 0===window||window.removeEventListener("scroll",this.scrollListener)),this.resizeListener&&(null===window||void 0===window||window.removeEventListener("resize",this.resizeListener))},t.prototype.render=function(t){for(var e=0,i=this.canvas.list;e<i.length;e++)i[e].render(t)},t}(),o=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)}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})},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)},t}();!function(t){t.px="px",t.vmin="vmin"}(i||(i={}));var r,s=function(){function t(){}return t.displayWidth=function(){return Math.max(window.innerWidth,document.body.clientWidth)},t.displayHeight=function(){return Math.max(window.innerHeight,document.body.clientHeight)},t.vmin=function(t){return void 0===t&&(t=1),Math.min(this.displayWidth(),this.displayHeight())/100*t},t.asmSize=function(t){var e=t.match(/(\d+\.?\d*)(\D+)/);if(e)return{value:Number(e[1]),measure:e[2]}},t.px=function(t){var e=this.asmSize(t);switch(null==e?void 0:e.measure){case i.px:return e.value;case i.vmin:return this.vmin(e.value)}},t}(),a=function(){function t(t,e){this.el=t,this.height=e,this._list=[],this.init()}return t.prototype.init=function(){this.el.style.height="".concat(this.height(s.displayWidth(),s.displayHeight()),"px")},t.prototype.elementY=function(){return this.el.getBoundingClientRect().y},t.prototype.add=function(t){this._list.push(t),t.initElement()},Object.defineProperty(t.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),t}(),l=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))},h=function(){function t(t){this.startStyle=t,this.frames=[]}return t.prototype.initStartPosition=function(){},t.prototype.afterBindElement=function(){},t.prototype.setStartCoord=function(t){this.startX=t.X,this.startY=t.Y},t.prototype.groupFramesByMotion=function(t){return t.reduce((function(t,e){var i=e.motion.name;return t[i]=t[i]?l(l([],t[i],!0),[e],!1):[e],t}),{})},t.prototype.render=function(t){for(var e,i=this.groupFramesByMotion(this.frames),n=0,o=Object.keys(i);n<o.length;n++)if(i[h=o[n]].length>1){var r=i[h].filter((function(e){return-t<e.getStartPos()&&-t+s.displayHeight()>=e.getStartPos()||-t>=e.getStartPos()&&-t+s.displayHeight()<=e.getEndPos()||-t>=e.getStartPos()&&-t<=e.getEndPos()}));1===r.length?i[h]=r:0===r.length&&i[h].length?(i[h].sort((function(t,e){return t.getStartPos()-e.getStartPos()})),-t+s.displayHeight()<i[h][0].getStartPos()?i[h]=[i[h][0]]:(i[h].sort((function(t,e){return t.getEndPos()>e.getEndPos()?-1:t.getEndPos()>e.getEndPos()?0:1})),-t>i[h][0].getEndPos()&&(i[h]=[i[h][0]]))):(r.sort((function(t,e){return t.getStartPos()-e.getStartPos()})),i[h]=[r[r.length-1]])}if(this.element)for(var a=0,l=Object.keys(i);a<l.length;a++){var h;(null===(e=i[h=l[a]])||void 0===e?void 0:e.length)&&i[h][0].motion.make(t,i[h][0],this.element)}},t.prototype.addFrame=function(t){this.frames.push(t)},t.prototype.addFrames=function(t){this.frames=this.frames.concat(t)},t.prototype.initElement=function(){this.initStartPosition(),this.element=this.bindElement(),this.afterBindElement()},t}(),c=function(){},d=(r=function(t,e){return r=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])},r(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 i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),u=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 d(e,t),e.prototype.renderX=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.left="".concat(this.startX(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.left="".concat(this.endX(s.displayWidth(),s.displayHeight()),"px"));var n=(this.endX(s.displayWidth(),s.displayHeight())-this.startX(s.displayWidth(),s.displayHeight()))/e.length(),o=this.startX(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.left="".concat(o,"px")}},e.prototype.renderY=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.top="".concat(t+this.startY(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.top="".concat(this.endY(s.displayWidth(),s.displayHeight())-(-t-e.getEndPos()),"px"));var n=(this.endY(s.displayWidth(),s.displayHeight())-this.startY(s.displayWidth(),s.displayHeight()))/e.length(),o=Math.round(this.startY(s.displayWidth(),s.displayHeight())+n*(e.getStartPos()-t));i.style.top="".concat(o,"px")}},e.prototype.make=function(t,e,i){this.renderX(t,e,i),this.renderY(t,e,i)},e}(c),p=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)}}(),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.calcStartPosition=function(){var t=this.frames.reduce((function(t,e){return e.motion instanceof u?t?e.getStartPos()<(null==t?void 0:t.getStartPos())?e:t:e:t||void 0}),void 0);if(t){var e=t.motion;if(!e.startX)throw new SyntaxError("'startX' wasn't found in the first frame");if(!e.startY)throw new SyntaxError("'startY' wasn't found in the first frame");return{X:e.startX,Y:e.startY}}throw new SyntaxError("First frame wasn't found")},e.prototype.bindElement=function(){return this.element},e}(h),y=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)}}(),g=function(t){function e(e,i){var n=t.call(this,i)||this;return n.element=e,n.startStyle=i,n}return y(e,t),e.prototype.initStartPosition=function(){this.setStartCoord(this.calcStartPosition())},e.prototype.bindElement=function(){return this.element&&(this.element.style.display="fixed"),this.element},e}(f),v=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)}}(),m=function(t){function e(e,i){var n=t.call(this,i)||this;return n.element=e,n.startStyle=i,n}return v(e,t),e.prototype.bindElement=function(){return this.element},e}(f),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)}}(),S=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 w(e,t),e.prototype.renderWidth=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.width="".concat(this.startWidth(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.width="".concat(this.endWidth(s.displayWidth(),s.displayHeight()),"px"));var n=(this.endWidth(s.displayWidth(),s.displayHeight())-this.startWidth(s.displayWidth(),s.displayHeight()))/e.length(),o=this.startWidth(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.width="".concat(o,"px")}},e.prototype.renderHeight=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.height="".concat(this.startHeight(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.height="".concat(this.endHeight(s.displayWidth(),s.displayHeight()),"px"));var n=(this.endHeight(s.displayWidth(),s.displayHeight())-this.startHeight(s.displayWidth(),s.displayHeight()))/e.length(),o=this.startHeight(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.height="".concat(o,"px")}},e.prototype.make=function(t,e,i){this.renderWidth(t,e,i),this.renderHeight(t,e,i)},e}(c),P=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)}}(),_=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 P(e,t),e.prototype.renderOpacity=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.opacity=this.start(s.displayWidth(),s.displayHeight()).toString());if(-t>e.getEndPos())return void(i.style.opacity=this.end(s.displayWidth(),s.displayHeight()).toString());var n=(this.end(s.displayWidth(),s.displayHeight())-this.start(s.displayWidth(),s.displayHeight()))/e.length(),o=this.start(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.opacity=o.toString()}},e.prototype.make=function(t,e,i){this.renderOpacity(t,e,i)},e}(c),H=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(s.displayWidth(),s.displayHeight())},t.prototype.getEndPos=function(){return this.end(s.displayWidth(),s.displayHeight())},t.prototype.length=function(){return this.getEndPos()-this.getStartPos()},t}();return e})()})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["scroll-rise"]=e():t["scroll-rise"]=e()}(this,(function(){return(()=>{"use strict";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),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Frame:()=>H,MoveMotion:()=>u,OpacityMotion:()=>_,RefWidget:()=>m,SRCanvas:()=>a,ScrollRise:()=>n,ScrollRiseSpeed:()=>o,SizeMotion:()=>S,StaticWidget:()=>g});var i,n=function(){function t(t){this.canvas=t,this.ticking=!1,this.init(),this.tick()}return t.prototype.tick=function(){var t=this;this.ticking||(null===window||void 0===window||window.requestAnimationFrame((function(){t.render(t.canvas.elementY()),t.ticking=!1})),this.ticking=!0)},t.prototype.scroll=function(){this.tick()},t.prototype.resize=function(){this.canvas.init(),this.tick()},t.prototype.init=function(){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)},t.prototype.stop=function(){this.scrollListener&&(null===window||void 0===window||window.removeEventListener("scroll",this.scrollListener)),this.resizeListener&&(null===window||void 0===window||window.removeEventListener("resize",this.resizeListener))},t.prototype.render=function(t){for(var e=0,i=this.canvas.list;e<i.length;e++)i[e].render(t)},t}(),o=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)}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})},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)},t}();!function(t){t.px="px",t.vmin="vmin"}(i||(i={}));var r,s=function(){function t(){}return t.displayWidth=function(){return Math.max(window.innerWidth,document.body.clientWidth)},t.displayHeight=function(){return Math.max(window.innerHeight,document.body.clientHeight)},t.vmin=function(t){return void 0===t&&(t=1),Math.min(this.displayWidth(),this.displayHeight())/100*t},t.asmSize=function(t){var e=t.match(/(\d+\.?\d*)(\D+)/);if(e)return{value:Number(e[1]),measure:e[2]}},t.px=function(t){var e=this.asmSize(t);switch(null==e?void 0:e.measure){case i.px:return e.value;case i.vmin:return this.vmin(e.value)}},t}(),a=function(){function t(t,e){this.el=t,this.height=e,this._list=[],this.init()}return t.prototype.init=function(){this.el.style.height="".concat(this.height(s.displayWidth(),s.displayHeight()),"px")},t.prototype.elementY=function(){return this.el.getBoundingClientRect().y},t.prototype.add=function(t){this._list.push(t),t.initElement()},Object.defineProperty(t.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),t}(),l=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))},h=function(){function t(t){this.startStyle=t,this.frames=[]}return t.prototype.initStartPosition=function(){},t.prototype.afterBindElement=function(){},t.prototype.setStartCoord=function(t){this.startX=t.X,this.startY=t.Y},t.prototype.groupFramesByMotion=function(t){return t.reduce((function(t,e){var i=e.motion.name;return t[i]=t[i]?l(l([],t[i],!0),[e],!1):[e],t}),{})},t.prototype.render=function(t){for(var e,i=this.groupFramesByMotion(this.frames),n=0,o=Object.keys(i);n<o.length;n++)if(i[h=o[n]].length>1){var r=i[h].filter((function(e){return-t<e.getStartPos()&&-t+s.displayHeight()>=e.getStartPos()||-t>=e.getStartPos()&&-t+s.displayHeight()<=e.getEndPos()||-t>=e.getStartPos()&&-t<=e.getEndPos()}));1===r.length?i[h]=r:0===r.length&&i[h].length?(i[h].sort((function(t,e){return t.getStartPos()-e.getStartPos()})),-t+s.displayHeight()<i[h][0].getStartPos()?i[h]=[i[h][0]]:(i[h].sort((function(t,e){return t.getEndPos()>e.getEndPos()?-1:t.getEndPos()>e.getEndPos()?0:1})),-t>i[h][0].getEndPos()&&(i[h]=[i[h][0]]))):(r.sort((function(t,e){return t.getStartPos()-e.getStartPos()})),i[h]=[r[r.length-1]])}if(this.element)for(var a=0,l=Object.keys(i);a<l.length;a++){var h;(null===(e=i[h=l[a]])||void 0===e?void 0:e.length)&&i[h][0].motion.make(t,i[h][0],this.element)}},t.prototype.addFrame=function(t){this.frames.push(t)},t.prototype.addFrames=function(t){this.frames=this.frames.concat(t)},t.prototype.initElement=function(){this.initStartPosition(),this.element=this.bindElement(),this.afterBindElement()},t}(),c=function(){},d=(r=function(t,e){return r=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])},r(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 i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),u=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 d(e,t),e.prototype.renderX=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.left="".concat(this.startX(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.left="".concat(this.endX(s.displayWidth(),s.displayHeight()),"px"));var n=(this.endX(s.displayWidth(),s.displayHeight())-this.startX(s.displayWidth(),s.displayHeight()))/e.length(),o=this.startX(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.left="".concat(o,"px")}},e.prototype.renderY=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.top="".concat(t+this.startY(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.top="".concat(this.endY(s.displayWidth(),s.displayHeight())-(-t-e.getEndPos()),"px"));var n=(this.endY(s.displayWidth(),s.displayHeight())-this.startY(s.displayWidth(),s.displayHeight()))/e.length(),o=Math.round(this.startY(s.displayWidth(),s.displayHeight())+n*(e.getStartPos()-t));i.style.top="".concat(o,"px")}},e.prototype.make=function(t,e,i){this.renderX(t,e,i),this.renderY(t,e,i)},e}(c),p=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)}}(),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return p(e,t),e.prototype.calcStartPosition=function(){var t=this.frames.reduce((function(t,e){return e.motion instanceof u?t?e.getStartPos()<(null==t?void 0:t.getStartPos())?e:t:e:t||void 0}),void 0);if(t){var e=t.motion;if(!e.startX)throw new SyntaxError("'startX' wasn't found in the first frame");if(!e.startY)throw new SyntaxError("'startY' wasn't found in the first frame");return{X:e.startX,Y:e.startY}}throw new SyntaxError("First frame wasn't found")},e.prototype.bindElement=function(){return this.element},e}(h),y=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)}}(),g=function(t){function e(e,i){var n=t.call(this,i)||this;return n.element=e,n.startStyle=i,n}return y(e,t),e.prototype.initStartPosition=function(){this.setStartCoord(this.calcStartPosition())},e.prototype.bindElement=function(){return this.element&&(this.element.style.display="fixed"),this.element},e}(f),v=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)}}(),m=function(t){function e(e,i){var n=t.call(this,i)||this;return n.element=e,n.startStyle=i,n}return v(e,t),e.prototype.bindElement=function(){return this.element},e}(f),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)}}(),S=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 w(e,t),e.prototype.renderWidth=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.width="".concat(this.startWidth(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.width="".concat(this.endWidth(s.displayWidth(),s.displayHeight()),"px"));var n=(this.endWidth(s.displayWidth(),s.displayHeight())-this.startWidth(s.displayWidth(),s.displayHeight()))/e.length(),o=this.startWidth(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.width="".concat(o,"px")}},e.prototype.renderHeight=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.height="".concat(this.startHeight(s.displayWidth(),s.displayHeight()),"px"));if(-t>e.getEndPos())return void(i.style.height="".concat(this.endHeight(s.displayWidth(),s.displayHeight()),"px"));var n=(this.endHeight(s.displayWidth(),s.displayHeight())-this.startHeight(s.displayWidth(),s.displayHeight()))/e.length(),o=this.startHeight(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.height="".concat(o,"px")}},e.prototype.make=function(t,e,i){this.renderWidth(t,e,i),this.renderHeight(t,e,i)},e}(c),P=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)}}(),_=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 P(e,t),e.prototype.renderOpacity=function(t,e,i){if(i){if(-t<e.getStartPos())return void(i.style.opacity=this.start(s.displayWidth(),s.displayHeight()).toString());if(-t>e.getEndPos())return void(i.style.opacity=this.end(s.displayWidth(),s.displayHeight()).toString());var n=(this.end(s.displayWidth(),s.displayHeight())-this.start(s.displayWidth(),s.displayHeight()))/e.length(),o=this.start(s.displayWidth(),s.displayHeight())+n*(-t-e.getStartPos());i.style.opacity=o.toString()}},e.prototype.make=function(t,e,i){this.renderOpacity(t,e,i)},e}(c),H=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(s.displayWidth(),s.displayHeight())},t.prototype.getEndPos=function(){return this.end(s.displayWidth(),s.displayHeight())},t.prototype.length=function(){return this.getEndPos()-this.getStartPos()},t}();return e})()})); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "scroll-rise", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "The typescript library for scroll animation", |
Sorry, the diff of this file is not supported yet
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
53733
0