Comparing version 0.0.3 to 0.0.4
import { TimeFrame } from '../time-frame'; | ||
import { Scene } from '../scenes/scene'; | ||
import { Scene, SceneOptions } from '../scenes/scene'; | ||
import { RenderingActorStrategy } from '../strategies/rendering-actor.strategy'; | ||
export declare abstract class Actor { | ||
import { ElementRecognition } from '../models/element-recognition'; | ||
import { Klass, RootKlassGuard } from '../models/rootKlassGuard'; | ||
export interface ActorOptions { | ||
} | ||
export declare class Actor<Options extends ActorOptions> implements RootKlassGuard { | ||
options?: Options | undefined; | ||
rootKlass: Klass; | ||
element?: HTMLElement; | ||
abstract bindElement(scrollPosOnFrame: number, scene: Scene<any>): HTMLElement | undefined; | ||
protected frames: TimeFrame[]; | ||
abstract findFirstMoveMotionFrame(): TimeFrame; | ||
afterBindElement(): void; | ||
renderActorStrategy: RenderingActorStrategy; | ||
constructor(element: ElementRecognition, options?: Options | undefined); | ||
private recognizeElement; | ||
bindElement(scrollPosOnScene: number, scene: Scene<SceneOptions>): void; | ||
beforeRender: () => void; | ||
afterRender: () => void; | ||
render(scrollPosOnScene: number, scene: Scene<any>): void; | ||
addFrame(frame: TimeFrame): void; | ||
render(scrollPosOnScene: number, scene: Scene<SceneOptions>): void; | ||
add(frame: TimeFrame | TimeFrame[]): void; | ||
/** | ||
* @deprecated since version 0.0.4 | ||
*/ | ||
addFrame(frame: TimeFrame | TimeFrame[]): void; | ||
/** | ||
* @deprecated since version 0.0.4 | ||
*/ | ||
addFrames(frames: TimeFrame[]): void; | ||
initElement(scrollPosOnScene: number, scene: Scene<any>): void; | ||
afterBindElement(): void; | ||
initElement(scrollPosOnScene: number, scene: Scene<SceneOptions>): void; | ||
turnOff(): void; | ||
} |
@@ -1,6 +0,6 @@ | ||
import { InitiableActor } from './initiable.actor'; | ||
export declare class RefActor extends InitiableActor { | ||
element: HTMLElement | undefined; | ||
constructor(element: HTMLElement | undefined); | ||
bindElement(): HTMLElement | undefined; | ||
import { Actor, ActorOptions } from './actor'; | ||
/** | ||
* @deprecated since version 0.0.4 | ||
*/ | ||
export declare class RefActor extends Actor<ActorOptions> { | ||
} |
@@ -1,4 +0,7 @@ | ||
import { InitiableActor } from './initiable.actor'; | ||
import { Scene } from '../scenes/scene'; | ||
export interface StaticActorOptions { | ||
import { Actor, ActorOptions } from './actor'; | ||
import { ElementRecognition } from '../models/element-recognition'; | ||
/** | ||
* @deprecated since version 0.0.4 | ||
*/ | ||
export interface StaticActorOptions extends ActorOptions { | ||
initPosition?: boolean; | ||
@@ -8,7 +11,7 @@ initSize?: boolean; | ||
} | ||
export declare class StaticActor extends InitiableActor { | ||
element: HTMLElement | undefined; | ||
options?: StaticActorOptions | undefined; | ||
constructor(element: HTMLElement | undefined, options?: StaticActorOptions | undefined); | ||
bindElement(scrollPosOnScene: number, scene: Scene<any>): HTMLElement | undefined; | ||
/** | ||
* @deprecated since version 0.0.4 | ||
*/ | ||
export declare class StaticActor extends Actor<StaticActorOptions> { | ||
constructor(element: ElementRecognition, options?: StaticActorOptions); | ||
} |
import { Scene, SceneOptions } from './scenes/scene'; | ||
import { Klass, RootKlassGuard } from './models/rootKlassGuard'; | ||
export interface BalletOptions { | ||
optimizeResizing: boolean; | ||
} | ||
export declare class Ballet { | ||
scene: Scene<SceneOptions>; | ||
export declare class Ballet implements RootKlassGuard { | ||
protected options?: BalletOptions | undefined; | ||
rootKlass: Klass; | ||
private initialized; | ||
@@ -14,3 +15,4 @@ private ticking; | ||
private clientHeight; | ||
constructor(scene: Scene<SceneOptions>, options?: BalletOptions | undefined); | ||
protected scenes: Array<Scene<SceneOptions>>; | ||
constructor(scene: Array<Scene<SceneOptions>> | Scene<SceneOptions>, options?: BalletOptions | undefined); | ||
protected setDefaults(): void; | ||
@@ -17,0 +19,0 @@ protected defaults(): BalletOptions; |
@@ -22,1 +22,5 @@ export { Ballet } from './ballet'; | ||
export { ResolutionModel } from './models/resolution.model'; | ||
export { ballet } from './factories/ballet.factory'; | ||
export { scene } from './factories/scene.factory'; | ||
export { actor } from './factories/actor.factory'; | ||
export { timeFrame } from './factories/time-frame.factory'; |
@@ -1,2 +0,2 @@ | ||
var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{so:()=>s,ko:()=>l,FK:()=>T,xy:()=>y,B6:()=>L,y_:()=>_,yz:()=>M,Jj:()=>x,Vi:()=>W,xs:()=>a,XC:()=>k,Rp:()=>S,jL:()=>f,nv:()=>m,Zr:()=>n});var 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.viewportWidth=function(){return window.innerWidth},t.viewportHeight=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.prepareMotionParams=function(t,e,n,i){var o=t-n.getStartPos();return{scrollPosOnScene:t,scrollPosOnFrame:o,delta:(o-i.offset())/n.length(),element:e,frame:n,scene:i}},t.windowSizes=function(){return{clientWidth:this.clientWidth(),clientHeight:this.clientHeight(),viewportWidth:this.viewportWidth(),viewportHeight:this.viewportHeight(),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}();function i(t){return function(e,n,i){var o=i.value;return i.value=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(null==t?void 0:t.before)&&this[t.before]&&this[t.before]();var i=o.apply(this,e);return(null==t?void 0:t.after)&&this[t.after]&&this[t.after](),i},i}}var o,r=function(){return r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},r.apply(this,arguments)},s=function(){function t(t,e){this.scene=t,this.options=e,this.initialized=!1,this.ticking=!1,this.setDefaults(),this.saveDisplaySize(),this.init(),this.tick()}return t.prototype.setDefaults=function(){this.options=r(r({},this.defaults()),this.options)},t.prototype.defaults=function(){return{optimizeResizing:!1}},t.prototype.saveDisplaySize=function(){this.clientWidth=n.clientWidth(),this.clientHeight=n.clientHeight()},t.prototype.isNeedResize=function(){var t;return!(null===(t=this.options)||void 0===t?void 0:t.optimizeResizing)||(n.clientWidth()!==this.clientWidth||n.clientHeight()!==this.clientHeight)&&(this.saveDisplaySize(),!0)},t.prototype.tick=function(){var t=this;this.ticking||(null===window||void 0===window||window.requestAnimationFrame((function(){t.render(),t.ticking=!1})),this.ticking=!0)},t.prototype.scroll=function(){this.tick()},t.prototype.resize=function(){this.isNeedResize()&&(this.scene.resize(),this.tick())},t.prototype.init=function(){if(this.initialized)throw new Error("Ballet 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("Ballet 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)),this.scene.turnOffScene()},t.prototype.render=function(){this.scene.render()},t.version=function(){return"0.0.3"},function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);r>3&&s&&Object.defineProperty(e,n,s)}([i({before:"beforeRender",after:"afterRender"})],t.prototype,"render",null),t}(),l=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,n,i=this;if(null===(n=null===(e=this.options)||void 0===e?void 0:e.excludeIds)||void 0===n?void 0:n.length)return document.elementsFromPoint(t.clientX,t.clientY).find((function(t){var e,n;return null===(n=null===(e=i.options)||void 0===e?void 0:e.excludeIds)||void 0===n?void 0:n.includes(t.id)}))},t.prototype.handleMouseWheel=function(t){var e,n;if(!this.exclude(t)){t.preventDefault();var i=t.deltaY;if(i=(null===(e=this.options)||void 0===e?void 0:e.deltaY)?i*this.options.deltaY:i,(null===(n=this.options)||void 0===n?void 0:n.limitY)&&Math.abs(i)>this.options.limitY&&(i=i>0?this.options.limitY:-this.options.limitY),scrollY+=i,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}(),c=function(){function t(t,e){this.element=t,this.grid=e,this.elements=[]}return t.prototype.createLabel=function(t,e,n){if(this.grid.label){var i=document.createElement("span");return i.style.position="absolute",i.style.top="".concat(e+this.grid.label.top,"px"),i.style.left="".concat(this.grid.label.left,"px"),i.style.color=n,i.style.fontSize=this.grid.label.fontSize,i.innerText=t.toString(),i}},t.prototype.appendToMeasuringGrid=function(t){this.elements.push(t),this.element.append(t)},t.prototype.createHorizontalLine=function(t,e,n){var i=document.createElement("hr");return i.style.position="absolute",i.style.width="100%",i.style.top="".concat(t,"px"),i.style.margin="0",i.style.border="none",i.style.borderBottom="1px ".concat(e," ").concat(n),i},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,l=null!==(i=null===(e=t.label)||void 0===e?void 0:e.startWith)&&void 0!==i?i:0,c=0;c<=s;c++){var h=c*r;if(this.appendToMeasuringGrid(this.createHorizontalLine(h,"solid",t.color)),t.label&&(p=this.createLabel(l,h,t.color))&&(this.appendToMeasuringGrid(p),l+=1),(null===(o=t.subgrid)||void 0===o?void 0:o.height)&&c+1<=s)for(var a=t.subgrid.height(r),u=h+a;u<h+r;){var p;this.appendToMeasuringGrid(this.createHorizontalLine(u,t.subgrid.borderStyle,t.subgrid.color)),t.label&&(p=this.createLabel(l,u,t.color))&&(this.appendToMeasuringGrid(p),l+=1),u+=a}}},t.prototype.createVerticalLine=function(t,e,n){var i=document.createElement("div");return i.style.position="absolute",i.style.left="".concat(t,"px"),i.style.width="0px",i.style.height="100%",i.style.borderLeft="1px ".concat(e," ").concat(n),i.style.top="0",i},t.prototype.appendVerticalSubgridLined=function(t,e,n){for(var i=n.width(e),o=t+i;o<t+e;)this.appendToMeasuringGrid(this.createVerticalLine(o,n.borderStyle,n.color)),o+=i},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}(),h=function(){return h=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},h.apply(this,arguments)},a=function(){function t(t,e,n){this.element=t,this.height=e,this.options=n,this._actors=[],this.turnedOn=!1,this.setDefaults(),this.turnOnScene(),this.resizeHeight(),this.initMeasuringGrid(),this.redrawMeasuringGrid()}return t.prototype.setDefaults=function(){this.options=h(h({},this.defaults()),this.options)},t.prototype.defaults=function(){return{offset:function(){return 0},checkResolution: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 c(this.element,this.options.measuringGrid))},t.prototype.elementY=function(){return this.element.getBoundingClientRect().y},t.prototype.platformHeightValue=function(){return this.platformHeight(n.clientWidth(),n.clientHeight())},t.prototype.scrollPos=function(){return-this.elementY()},t.prototype.elementHeight=function(){return this.height(n.clientWidth(),n.clientHeight())},t.prototype.add=function(t){this._actors.push(t),this.placeActor(t)},t.prototype.placeAllActors=function(){var t=this;this.actors.forEach((function(e){return t.placeActor(e)}))},Object.defineProperty(t.prototype,"actors",{get:function(){return this._actors},enumerable:!1,configurable:!0}),t.prototype.interceptY=function(t,e){return t},t.prototype.redrawMeasuringGrid=function(){this.grid&&this.grid.redrawMeasuringGrid()},t.prototype.resize=function(){this.checkResolution()?(this.turnedOn||this.turnOnScene(),this.resizeHeight(),this.redrawMeasuringGrid()):this.turnedOn&&this.turnOffScene()},t.prototype.render=function(){if(this.checkResolution())for(var t=0,e=this.actors;t<e.length;t++)e[t].render(this.scrollPos(),this)},t.prototype.checkResolution=function(){return this.options.checkResolution({viewportWidth:n.viewportWidth(),viewportHeight:n.viewportHeight()})},t.prototype.turnOnScene=function(){!this.turnedOn&&this.checkResolution()&&(this.turnOn(),this.turnedOn=!0)},t.prototype.turnOffScene=function(){this.turnedOn&&(this.turnOff(),this.turnedOn=!1)},function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);r>3&&s&&Object.defineProperty(e,n,s)}([i({before:"beforeRender",after:"afterRender"})],t.prototype,"render",null),t}(),u=(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},o(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}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=function(){return p=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},p.apply(this,arguments)},f=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="StickyPlatformScene",e}return u(e,t),e.prototype.platformHeight=function(t,e){return this.options.stickyPlatformHeight(t,e)},e.prototype.defaults=function(){return p(p({},t.prototype.defaults.call(this)),{stickyPlatformHeight:function(t,e){return e}})},e.prototype.resizeHeight=function(){this.checkResolution()&&(this.element.style.height="".concat(this.height(n.clientWidth(),n.clientHeight()),"px"),this.resizePlatform())},e.prototype.resizePlatform=function(){this.platform.style.height="".concat(this.platformHeightValue(),"px")},e.prototype.turnOn=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.platform.style.overflow="hidden",this.element.appendChild(this.platform),this.placeAllActors()},e.prototype.turnOff=function(){var t=this;this.actors.forEach((function(e){var n,i;e.turnOff(),(null===(n=e.element)||void 0===n?void 0:n.parentElement)===t.platform&&(t.element.appendChild(e.element),null===(i=e.element)||void 0===i||i.style.removeProperty("position"))})),this.platform.parentNode.removeChild(this.platform),this.element.style.removeProperty("height"),this.element.style.removeProperty("position"),this.element.style.removeProperty("overflow")},e.prototype.placeActor=function(t){var e;this.checkResolution()&&(this.element===(null===(e=t.element)||void 0===e?void 0:e.parentElement)&&(this.platform.appendChild(t.element),t.element.style.position="absolute"),t.initElement(this.elementY(),this))},e}(a),d=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="FixedActorsScene",e}return d(e,t),e.prototype.platformHeight=function(t,e){return e},e.prototype.resizeHeight=function(){this.checkResolution()&&(this.element.style.height="".concat(this.height(n.clientWidth(),n.clientHeight()),"px"))},e.prototype.turnOn=function(){this.element.style.position="relative",this.placeAllActors()},e.prototype.turnOff=function(){this.actors.forEach((function(t){var e;t.turnOff(),null===(e=t.element)||void 0===e||e.style.removeProperty("position")})),this.element.style.removeProperty("position")},e.prototype.placeActor=function(t){this.checkResolution()&&(t.element.style.position="fixed",t.initElement(this.elementY(),this))},e.prototype.interceptY=function(e,n){return n.scrollPosOnScene<0?e-n.scrollPosOnScene:n.scrollPosOnScene>this.elementHeight()-this.platformHeightValue()?e-this.platformHeightValue()+this.elementHeight()+this.elementY():t.prototype.interceptY.call(this,e,n)},e}(a),m=function(){function t(t,e,n){if(void 0===n&&(n=e),this.motion=t,this.start=e,this.end=n,void 0===n)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}(),g=function(){function t(){this.frameGroups={},this.startFrame={},this.endFrame={}}return t.prototype.groupFramesByMotion=function(t){return t.reduce((function(t,e){var n=e.motion.motionName();return t[n]=t[n]?function(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o<r;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}([e],t[n],!0):[e],t}),{})},t.prototype.prerender=function(t){this.frameGroups=this.groupFramesByMotion(t);for(var e=0,n=Object.keys(this.frameGroups);e<n.length;e++){var i=n[e],o=this.frameGroups[i];if(o.length){this.startFrame[i]=o[0],this.endFrame[i]=o[0];for(var r=0,s=o;r<s.length;r++){var l=s[r];l.getStartPos()<this.startFrame[i].getStartPos()&&(this.startFrame[i]=l),l.getEndPos()>this.endFrame[i].getEndPos()&&(this.endFrame[i]=l)}}}},t.prototype.findFirstHit=function(t,e){return t.find((function(t){return e>=t.getStartPos()&&e<=t.getEndPos()}))},t.prototype.findNearestFrameForHole=function(t,e){var n=t.filter((function(t){return t.getEndPos()<=e}));if(n.length){for(var i=n[0],o=0,r=n;o<r.length;o++){var s=r[o];s.getEndPos()>i.getEndPos()&&(i=s)}return i}},t.prototype.lookIntoHoles=function(t,e,n){return e<=this.startFrame[n].getStartPos()?this.startFrame[n]:e>=this.endFrame[n].getEndPos()?this.endFrame[n]:this.findNearestFrameForHole(t,e)},t.prototype.takeRenderFrame=function(t){for(var e,n=[],i=0,o=Object.keys(this.frameGroups);i<o.length;i++){var r=o[i],s=this.frameGroups[r];if(null==s?void 0:s.length){var l=null!==(e=this.findFirstHit(s,t))&&void 0!==e?e:this.lookIntoHoles(s,t,r);l&&n.push(l)}}return n},t}(),v=function(){function t(){this.frames=[],this.renderActorStrategy=new g}return t.prototype.afterBindElement=function(){},t.prototype.render=function(t,e){var i=this;if(!this.element)throw new Error("Here isn't an element");this.renderActorStrategy.takeRenderFrame(t).forEach((function(o){return o.motion.make(n.prepareMotionParams(t,i.element,o,e))}))},t.prototype.addFrame=function(t){this.addFrames([t])},t.prototype.addFrames=function(t){this.frames=this.frames.concat(t),this.renderActorStrategy.prerender(this.frames)},t.prototype.initElement=function(t,e){this.element=this.bindElement(t,e),this.afterBindElement()},t.prototype.turnOff=function(){var t=this;this.frames.forEach((function(e){t.element&&e.motion.turnOff(t.element)}))},function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);r>3&&s&&Object.defineProperty(e,n,s)}([i({before:"beforeRender",after:"afterRender"})],t.prototype,"render",null),t}(),w=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),O=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return w(e,t),e.prototype.findFirstFrame=function(t){return this.frames.reduce((function(e,n){return n.motion.motionName()===t?e?n.getStartPos()<(null==e?void 0:e.getStartPos())?n:e:n: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}(v),b=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),H=function(){return H=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},H.apply(this,arguments)},S=function(t){function e(e,n){var i=t.call(this)||this;return i.element=e,i.options=n,i.options=H({initPosition:!0,initSize:!0,initOpacity:!0},i.options),i}return b(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(n.prepareMotionParams(t,this.element,s,e))}if(null===(o=this.options)||void 0===o?void 0:o.initSize){var l=this.calcStartSize();this.element.style.width="".concat(l.width(n.clientWidth(),n.clientHeight()),"px"),this.element.style.height="".concat(l.height(n.clientWidth(),n.clientHeight()),"px")}if(null===(r=this.options)||void 0===r?void 0:r.initOpacity){var c=this.calcStartOpacity();this.element.style.opacity="".concat(c(n.clientWidth(),n.clientHeight()))}}return this.element},e}(O),P=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),W=function(t){function e(e){var n=t.call(this)||this;return n.element=e,n}return P(e,t),e.prototype.bindElement=function(){return this.element},e}(O),_=function(){function t(){}return t.prototype.motionName=function(){return this.name},t}(),E=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),L=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return E(e,t),e.prototype.make=function(t){if(!t.element)throw new Error("There is no element");t.delta<=0?this.makeStartStep(t):t.delta>=1?this.makeEndStep(t):this.makeUsualStep(t)},e}(_),j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),M=function(t){function e(e){var n=t.call(this)||this;return n.name="MoveMotion",n.startX=e.startX,n.endX=e.endX,n.startY=e.startY,n.endY=e.endY,n}return j(e,t),e.prototype.setLeft=function(t,e){t.style.left="".concat(e,"px")},e.prototype.setTop=function(t,e){var n=t.scene.interceptY(e,t);t.element.style.top="".concat(n,"px")},e.prototype.makeStartStep=function(t){var e=this.startX(n.clientWidth(),n.clientHeight());this.setLeft(t.element,e);var i=this.startY(n.clientWidth(),n.clientHeight());this.setTop(t,i)},e.prototype.makeEndStep=function(t){var e=this.endX(n.clientWidth(),n.clientHeight());this.setLeft(t.element,e);var i=this.endY(n.clientWidth(),n.clientHeight());this.setTop(t,i)},e.prototype.makeUsualStep=function(t){var e=this.endX(n.clientWidth(),n.clientHeight())-this.startX(n.clientWidth(),n.clientHeight()),i=n.castToInt(this.startX(n.clientWidth(),n.clientHeight())+e*t.delta);this.setLeft(t.element,i);var o=this.endY(n.clientWidth(),n.clientHeight())-this.startY(n.clientWidth(),n.clientHeight()),r=n.castToInt(this.startY(n.clientWidth(),n.clientHeight())+o*t.delta);this.setTop(t,r)},e.prototype.turnOff=function(t){t.style.removeProperty("left"),t.style.removeProperty("top")},e}(L),z=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),k=function(t){function e(e){var n=t.call(this)||this;return n.name="SizeMotion",n.startWidth=e.startWidth,n.endWidth=e.endWidth,n.startHeight=e.startHeight,n.endHeight=e.endHeight,n}return z(e,t),e.prototype.setWidth=function(t,e){t.element.style.width="".concat(e,"px")},e.prototype.setHeight=function(t,e){t.element.style.height="".concat(e,"px")},e.prototype.makeStartStep=function(t){var e=this.startWidth(n.clientWidth(),n.clientHeight());this.setWidth(t,e);var i=this.startHeight(n.clientWidth(),n.clientHeight());this.setHeight(t,i)},e.prototype.makeEndStep=function(t){var e=this.endWidth(n.clientWidth(),n.clientHeight());this.setWidth(t,e);var i=this.endHeight(n.clientWidth(),n.clientHeight());this.setHeight(t,i)},e.prototype.makeUsualStep=function(t){var e=this.endWidth(n.clientWidth(),n.clientHeight())-this.startWidth(n.clientWidth(),n.clientHeight()),i=n.castToInt(this.startWidth(n.clientWidth(),n.clientHeight())+e*t.delta);this.setWidth(t,i);var o=this.endHeight(n.clientWidth(),n.clientHeight())-this.startHeight(n.clientWidth(),n.clientHeight()),r=n.castToInt(this.startHeight(n.clientWidth(),n.clientHeight())+o*t.delta);this.setHeight(t,r)},e.prototype.turnOff=function(t){t.style.removeProperty("width"),t.style.removeProperty("height")},e}(L),F=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),x=function(t){function e(e){var n=t.call(this)||this;return n.name="OpacityMotion",n.start=e.start,n.end=e.end,n}return F(e,t),e.prototype.setOpacity=function(t,e){t.element.style.opacity=e.toString()},e.prototype.makeStartStep=function(t){var e=this.start(n.clientWidth(),n.clientHeight());this.setOpacity(t,e)},e.prototype.makeEndStep=function(t){var e=this.end(n.clientWidth(),n.clientHeight());this.setOpacity(t,e)},e.prototype.makeUsualStep=function(t){var e=this.end(n.clientWidth(),n.clientHeight())-this.start(n.clientWidth(),n.clientHeight()),i=this.start(n.clientWidth(),n.clientHeight())+e*t.delta;this.setOpacity(t,i)},e.prototype.turnOff=function(t){t.style.removeProperty("opacity")},e}(L),R=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),Y=function(){return Y=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Y.apply(this,arguments)},T=function(t){function e(e){var n=t.call(this)||this;return n.name="BoundMotion",n.before=e.before,n.after=e.after,n}return R(e,t),e.prototype.applyProperties=function(t,e){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];t.style[o]=e[o]}},e.prototype.make=function(t){if(!t.element)throw new Error("There is no element");t.scrollPosOnScene<t.frame.getStartPos()?this.applyProperties(t.element,this.before(n.clientWidth(),n.clientHeight())):this.applyProperties(t.element,this.after(n.clientWidth(),n.clientHeight()))},e.prototype.turnOff=function(t){for(var e=0,i=Object.keys(Y(Y({},this.before(n.clientWidth(),n.clientHeight())),this.after(n.clientWidth(),n.clientHeight())));e<i.length;e++){var o=i[e];t.style.removeProperty(o)}},e}(_),A=e.so,G=e.ko,C=e.FK,B=e.xy,V=e.B6,D=e.y_,X=e.yz,I=e.Jj,N=e.Vi,U=e.xs,J=e.XC,K=e.Rp,Z=e.jL,q=e.nv,Q=e.Zr;export{A as Ballet,G as BalletScrollSpeed,C as BoundMotion,B as FixedActorsScene,V as FramedMotion,D as Motion,X as MoveMotion,I as OpacityMotion,N as RefActor,U as Scene,J as SizeMotion,K as StaticActor,Z as StickyPlatformScene,q as TimeFrame,Q as Util}; | ||
var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{so:()=>a,ko:()=>h,FK:()=>D,xy:()=>b,B6:()=>M,y_:()=>k,yz:()=>x,Jj:()=>G,Vi:()=>z,xs:()=>y,XC:()=>T,Rp:()=>L,jL:()=>v,nv:()=>O,Zr:()=>i,$K:()=>X,zk:()=>U,Ah:()=>N,KZ:()=>I});var n,i=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.viewportWidth=function(){return window.innerWidth},t.viewportHeight=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.prepareMotionParams=function(t,e,n,i){var o=t-n.getStartPos();return{scrollPosOnScene:t,scrollPosOnFrame:o,delta:(o-i.offset())/n.length(),element:e,frame:n,scene:i}},t.windowSizes=function(){return{clientWidth:this.clientWidth(),clientHeight:this.clientHeight(),viewportWidth:this.viewportWidth(),viewportHeight:this.viewportHeight(),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}();function o(t){return function(e,n,i){var o=i.value;return i.value=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];(null==t?void 0:t.before)&&this[t.before]&&this[t.before]();var i=o.apply(this,e);return(null==t?void 0:t.after)&&this[t.after]&&this[t.after](),i},i}}function r(){return function(t,e,n){var i="".concat(e,"__InitFlag"),o=n.value;return n.value=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(this[i])throw new Error("".concat(e," method has been already fired once!"));return this[i]=!0,o.apply(this,t)},n}}!function(t){t.Scene="scene",t.Actor="actor",t.TimeFrame="time-frame",t.Motion="motion",t.Lib="lib"}(n||(n={}));var s,c=function(){return c=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},c.apply(this,arguments)},l=function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},a=function(){function t(t,e){this.options=e,this.rootKlass=n.Lib,this.initialized=!1,this.ticking=!1,Array.isArray(t)?this.scenes=t:this.scenes=[t],this.setDefaults(),this.saveDisplaySize(),this.init(),this.tick()}return t.prototype.setDefaults=function(){this.options=c(c({},this.defaults()),this.options)},t.prototype.defaults=function(){return{optimizeResizing:!1}},t.prototype.saveDisplaySize=function(){this.clientWidth=i.clientWidth(),this.clientHeight=i.clientHeight()},t.prototype.isNeedResize=function(){var t;return!(null===(t=this.options)||void 0===t?void 0:t.optimizeResizing)||(i.clientWidth()!==this.clientWidth||i.clientHeight()!==this.clientHeight)&&(this.saveDisplaySize(),!0)},t.prototype.tick=function(){var t=this;this.ticking||(null===window||void 0===window||window.requestAnimationFrame((function(){t.render(),t.ticking=!1})),this.ticking=!0)},t.prototype.scroll=function(){this.tick()},t.prototype.resize=function(){this.isNeedResize()&&(this.scenes.forEach((function(t){return t.resize()})),this.tick())},t.prototype.init=function(){if(this.initialized)throw new Error("Ballet 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("Ballet 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)),this.scenes.forEach((function(t){return t.turnOffScene()}))},t.prototype.render=function(){this.scenes.forEach((function(t){return t.render()}))},t.version=function(){return"0.0.4"},l([r()],t.prototype,"setDefaults",null),l([r()],t.prototype,"init",null),l([o({before:"beforeRender",after:"afterRender"})],t.prototype,"render",null),t}(),h=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,n,i=this;if(null===(n=null===(e=this.options)||void 0===e?void 0:e.excludeIds)||void 0===n?void 0:n.length)return document.elementsFromPoint(t.clientX,t.clientY).find((function(t){var e,n;return null===(n=null===(e=i.options)||void 0===e?void 0:e.excludeIds)||void 0===n?void 0:n.includes(t.id)}))},t.prototype.handleMouseWheel=function(t){var e,n;if(!this.exclude(t)){t.preventDefault();var i=t.deltaY;if(i=(null===(e=this.options)||void 0===e?void 0:e.deltaY)?i*this.options.deltaY:i,(null===(n=this.options)||void 0===n?void 0:n.limitY)&&Math.abs(i)>this.options.limitY&&(i=i>0?this.options.limitY:-this.options.limitY),scrollY+=i,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}(),u=function(){function t(t,e){this.element=t,this.grid=e,this.elements=[]}return t.prototype.createLabel=function(t,e,n){if(this.grid.label){var i=document.createElement("span");return i.style.position="absolute",i.style.top="".concat(e+this.grid.label.top,"px"),i.style.left="".concat(this.grid.label.left,"px"),i.style.color=n,i.style.fontSize=this.grid.label.fontSize,i.innerText=t.toString(),i}},t.prototype.appendToMeasuringGrid=function(t){this.elements.push(t),this.element.append(t)},t.prototype.createHorizontalLine=function(t,e,n){var i=document.createElement("hr");return i.style.position="absolute",i.style.width="100%",i.style.top="".concat(t,"px"),i.style.margin="0",i.style.border="none",i.style.borderBottom="1px ".concat(e," ").concat(n),i},t.prototype.appendHorizontalGridLines=function(t){for(var e,n,o,r=t.height(i.clientWidth(),i.clientHeight(),this.element.getBoundingClientRect().height),s=this.element.getBoundingClientRect().height/r,c=null!==(n=null===(e=t.label)||void 0===e?void 0:e.startWith)&&void 0!==n?n:0,l=0;l<=s;l++){var a=l*r;if(this.appendToMeasuringGrid(this.createHorizontalLine(a,"solid",t.color)),t.label&&(p=this.createLabel(c,a,t.color))&&(this.appendToMeasuringGrid(p),c+=1),(null===(o=t.subgrid)||void 0===o?void 0:o.height)&&l+1<=s)for(var h=t.subgrid.height(r),u=a+h;u<a+r;){var p;this.appendToMeasuringGrid(this.createHorizontalLine(u,t.subgrid.borderStyle,t.subgrid.color)),t.label&&(p=this.createLabel(c,u,t.color))&&(this.appendToMeasuringGrid(p),c+=1),u+=h}}},t.prototype.createVerticalLine=function(t,e,n){var i=document.createElement("div");return i.style.position="absolute",i.style.left="".concat(t,"px"),i.style.width="0px",i.style.height="100%",i.style.borderLeft="1px ".concat(e," ").concat(n),i.style.top="0",i},t.prototype.appendVerticalSubgridLined=function(t,e,n){for(var i=n.width(e),o=t+i;o<t+e;)this.appendToMeasuringGrid(this.createVerticalLine(o,n.borderStyle,n.color)),o+=i},t.prototype.appendVerticalGridLines=function(t){var e,n,o=t.width(i.clientWidth(),i.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===(n=t.subgrid)||void 0===n?void 0:n.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}(),p=function(){function t(){}return t.init=function(t){if("string"==typeof t){var e=document.querySelector(t);if(!e)throw new Error("Can't select element by \"".concat(t,'" selector'));return e}if(t instanceof HTMLElement)return t;throw new Error("Invalid type of scene's element")},t}(),f=function(){return f=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},f.apply(this,arguments)},d=function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},y=function(){function t(t,e,i){this.height=e,this.options=i,this.rootKlass=n.Scene,this._actors=[],this.turnedOn=!1,this.recognizeElement(t),this.setDefaults(),this.turnOnScene(),this.resizeHeight(),this.initMeasuringGrid(),this.redrawMeasuringGrid()}return t.prototype.recognizeElement=function(t){this.element=p.init(t)},t.prototype.setDefaults=function(){this.options=f(f({},this.defaults()),this.options)},t.prototype.defaults=function(){return{offset:function(){return 0},checkResolution:function(){return!0}}},t.prototype.offset=function(){return this.options.offset(i.clientWidth(),i.clientHeight(),this.elementHeight())},t.prototype.initMeasuringGrid=function(){var t;(null===(t=this.options)||void 0===t?void 0:t.measuringGrid)&&(this.grid=new u(this.element,this.options.measuringGrid))},t.prototype.platformHeightValue=function(){return this.platformHeight(i.clientWidth(),i.clientHeight())},t.prototype.elementY=function(){return this.element.getBoundingClientRect().y},t.prototype.scrollPos=function(){return-this.elementY()},t.prototype.elementHeight=function(){return this.height(i.clientWidth(),i.clientHeight())},t.prototype.add=function(t){var e=this;Array.isArray(t)?t.forEach((function(t){e._actors.push(t),e.placeActor(t)})):(this._actors.push(t),this.placeActor(t))},t.prototype.placeAllActors=function(){var t=this;this.actors.forEach((function(e){return t.placeActor(e)}))},Object.defineProperty(t.prototype,"actors",{get:function(){return this._actors},enumerable:!1,configurable:!0}),t.prototype.interceptY=function(t,e){return t},t.prototype.redrawMeasuringGrid=function(){this.grid&&this.grid.redrawMeasuringGrid()},t.prototype.resize=function(){this.checkResolution()?(this.turnedOn||this.turnOnScene(),this.resizeHeight(),this.redrawMeasuringGrid()):this.turnedOn&&this.turnOffScene()},t.prototype.render=function(){if(this.checkResolution())for(var t=0,e=this.actors;t<e.length;t++)e[t].render(this.scrollPos(),this)},t.prototype.checkResolution=function(){return this.options.checkResolution({viewportWidth:i.viewportWidth(),viewportHeight:i.viewportHeight()})},t.prototype.turnOnScene=function(){!this.turnedOn&&this.checkResolution()&&(this.turnOn(),this.turnedOn=!0)},t.prototype.turnOffScene=function(){this.turnedOn&&(this.turnOff(),this.turnedOn=!1)},d([r()],t.prototype,"recognizeElement",null),d([r()],t.prototype,"setDefaults",null),d([r()],t.prototype,"initMeasuringGrid",null),d([o({before:"beforeRender",after:"afterRender"})],t.prototype,"render",null),t}(),m=(s=function(t,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},s(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}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),g=function(){return g=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},g.apply(this,arguments)},v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="StickyPlatformScene",e}return m(e,t),e.prototype.platformHeight=function(t,e){return this.options.stickyPlatformHeight(t,e)},e.prototype.defaults=function(){return g(g({},t.prototype.defaults.call(this)),{stickyPlatformHeight:function(t,e){return e}})},e.prototype.resizeHeight=function(){this.checkResolution()&&(this.element.style.height="".concat(this.height(i.clientWidth(),i.clientHeight()),"px"),this.resizePlatform())},e.prototype.resizePlatform=function(){this.platform.style.height="".concat(this.platformHeightValue(),"px")},e.prototype.turnOn=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.platform.style.overflow="hidden",this.element.appendChild(this.platform),this.placeAllActors()},e.prototype.turnOff=function(){var t=this;this.actors.forEach((function(e){var n,i;e.turnOff(),(null===(n=e.element)||void 0===n?void 0:n.parentElement)===t.platform&&(t.element.appendChild(e.element),null===(i=e.element)||void 0===i||i.style.removeProperty("position"))})),this.platform.parentNode.removeChild(this.platform),this.element.style.removeProperty("height"),this.element.style.removeProperty("position"),this.element.style.removeProperty("overflow")},e.prototype.placeActor=function(t){var e;this.checkResolution()&&(this.element===(null===(e=t.element)||void 0===e?void 0:e.parentElement)&&(this.platform.appendChild(t.element),t.element.style.position="absolute"),t.initElement(this.elementY(),this))},e}(y),w=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),b=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="FixedActorsScene",e}return w(e,t),e.prototype.platformHeight=function(t,e){return e},e.prototype.resizeHeight=function(){this.checkResolution()&&(this.element.style.height="".concat(this.height(i.clientWidth(),i.clientHeight()),"px"))},e.prototype.turnOn=function(){this.element.style.position="relative",this.placeAllActors()},e.prototype.turnOff=function(){this.actors.forEach((function(t){var e;t.turnOff(),null===(e=t.element)||void 0===e||e.style.removeProperty("position")})),this.element.style.removeProperty("position")},e.prototype.placeActor=function(t){this.checkResolution()&&(t.element.style.position="fixed",t.initElement(this.elementY(),this))},e.prototype.interceptY=function(e,n){return n.scrollPosOnScene<0?e-n.scrollPosOnScene:n.scrollPosOnScene>this.elementHeight()-this.platformHeightValue()?e-this.platformHeightValue()+this.elementHeight()+this.elementY():t.prototype.interceptY.call(this,e,n)},e}(y),H=function(){function t(){}return t.prepare=function(t){return"function"==typeof t?t:function(){return t}},t}(),O=function(){function t(t,e,i){if(this.motion=t,this.rootKlass=n.TimeFrame,this.start=void 0===e?H.prepare(0):H.prepare(e),this.end=this.end=void 0===i?this.start:H.prepare(i),this.getStartPos()>this.getEndPos())throw new SyntaxError('"Start" later than "End" in the frame')}return t.prototype.getStartPos=function(){return this.start(i.clientWidth(),i.clientHeight())},t.prototype.getEndPos=function(){return this.end(i.clientWidth(),i.clientHeight())},t.prototype.length=function(){return this.getEndPos()-this.getStartPos()},t}(),E=function(){function t(){this.frameGroups={},this.startFrame={},this.endFrame={}}return t.prototype.groupFramesByMotion=function(t){return t.reduce((function(t,e){var n=e.motion.motionName();return t[n]=t[n]?function(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o<r;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))}([e],t[n],!0):[e],t}),{})},t.prototype.prerender=function(t){this.frameGroups=this.groupFramesByMotion(t);for(var e=0,n=Object.keys(this.frameGroups);e<n.length;e++){var i=n[e],o=this.frameGroups[i];if(o.length){this.startFrame[i]=o[0],this.endFrame[i]=o[0];for(var r=0,s=o;r<s.length;r++){var c=s[r];c.getStartPos()<this.startFrame[i].getStartPos()&&(this.startFrame[i]=c),c.getEndPos()>this.endFrame[i].getEndPos()&&(this.endFrame[i]=c)}}}},t.prototype.findFirstHit=function(t,e){return t.find((function(t){return e>=t.getStartPos()&&e<=t.getEndPos()}))},t.prototype.findNearestFrameForHole=function(t,e){var n=t.filter((function(t){return t.getEndPos()<=e}));if(n.length){for(var i=n[0],o=0,r=n;o<r.length;o++){var s=r[o];s.getEndPos()>i.getEndPos()&&(i=s)}return i}},t.prototype.lookIntoHoles=function(t,e,n){return e<=this.startFrame[n].getStartPos()?this.startFrame[n]:e>=this.endFrame[n].getEndPos()?this.endFrame[n]:this.findNearestFrameForHole(t,e)},t.prototype.takeRenderFrame=function(t){for(var e,n=[],i=0,o=Object.keys(this.frameGroups);i<o.length;i++){var r=o[i],s=this.frameGroups[r];if(null==s?void 0:s.length){var c=null!==(e=this.findFirstHit(s,t))&&void 0!==e?e:this.lookIntoHoles(s,t,r);c&&n.push(c)}}return n},t}(),S=function(t,e,n,i){var o,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(s=(r<3?o(s):r>3?o(e,n,s):o(e,n))||s);return r>3&&s&&Object.defineProperty(e,n,s),s},P=function(){function t(t,e){this.options=e,this.rootKlass=n.Actor,this.frames=[],this.renderActorStrategy=new E,this.recognizeElement(t)}return t.prototype.recognizeElement=function(t){this.element=p.init(t)},t.prototype.bindElement=function(t,e){},t.prototype.render=function(t,e){var n=this;if(!this.element)throw new Error("Here isn't an element");this.renderActorStrategy.takeRenderFrame(t).forEach((function(o){return o.motion.make(i.prepareMotionParams(t,n.element,o,e))}))},t.prototype.add=function(t){Array.isArray(t)?this.frames=this.frames.concat(t):this.frames.push(t),this.renderActorStrategy.prerender(this.frames)},t.prototype.addFrame=function(t){this.add(t)},t.prototype.addFrames=function(t){this.add(t)},t.prototype.afterBindElement=function(){},t.prototype.initElement=function(t,e){this.bindElement(t,e),this.afterBindElement()},t.prototype.turnOff=function(){var t=this;this.frames.forEach((function(e){t.element&&e.motion.turnOff(t.element)}))},S([r()],t.prototype,"recognizeElement",null),S([o({before:"beforeRender",after:"afterRender"})],t.prototype,"render",null),S([o({after:"afterBindElement"})],t.prototype,"initElement",null),t}(),W=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),_=function(){return _=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},_.apply(this,arguments)},L=function(t){function e(e,n){var i=t.call(this,e,n)||this;return i.options=_({initPosition:!0,initSize:!0,initOpacity:!0},i.options),i}return W(e,t),e}(P),j=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return j(e,t),e}(P),k=function(){function t(){this.rootKlass=n.Motion}return t.prototype.motionName=function(){return this.name},t}(),A=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),M=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return A(e,t),e.prototype.make=function(t){if(!t.element)throw new Error("There is no element");t.delta<=0?this.makeStartStep(t):t.delta>=1?this.makeEndStep(t):this.makeUsualStep(t)},e}(k),R=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),x=function(t){function e(e){var n=t.call(this)||this;return n.name="MoveMotion",n.startX=H.prepare(e.startX),n.endX=H.prepare(e.endX),n.startY=H.prepare(e.startY),n.endY=H.prepare(e.endY),n}return R(e,t),e.prototype.setLeft=function(t,e){t.style.left="".concat(e,"px")},e.prototype.setTop=function(t,e){var n=t.scene.interceptY(e,t);t.element.style.top="".concat(n,"px")},e.prototype.makeStartStep=function(t){var e=this.startX(i.clientWidth(),i.clientHeight());this.setLeft(t.element,e);var n=this.startY(i.clientWidth(),i.clientHeight());this.setTop(t,n)},e.prototype.makeEndStep=function(t){var e=this.endX(i.clientWidth(),i.clientHeight());this.setLeft(t.element,e);var n=this.endY(i.clientWidth(),i.clientHeight());this.setTop(t,n)},e.prototype.makeUsualStep=function(t){var e=this.endX(i.clientWidth(),i.clientHeight())-this.startX(i.clientWidth(),i.clientHeight()),n=i.castToInt(this.startX(i.clientWidth(),i.clientHeight())+e*t.delta);this.setLeft(t.element,n);var o=this.endY(i.clientWidth(),i.clientHeight())-this.startY(i.clientWidth(),i.clientHeight()),r=i.castToInt(this.startY(i.clientWidth(),i.clientHeight())+o*t.delta);this.setTop(t,r)},e.prototype.turnOff=function(t){t.style.removeProperty("left"),t.style.removeProperty("top")},e}(M),F=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),T=function(t){function e(e){var n=t.call(this)||this;return n.name="SizeMotion",n.startWidth=H.prepare(e.startWidth),n.endWidth=H.prepare(e.endWidth),n.startHeight=H.prepare(e.startHeight),n.endHeight=H.prepare(e.endHeight),n}return F(e,t),e.prototype.setWidth=function(t,e){t.element.style.width="".concat(e,"px")},e.prototype.setHeight=function(t,e){t.element.style.height="".concat(e,"px")},e.prototype.makeStartStep=function(t){var e=this.startWidth(i.clientWidth(),i.clientHeight());this.setWidth(t,e);var n=this.startHeight(i.clientWidth(),i.clientHeight());this.setHeight(t,n)},e.prototype.makeEndStep=function(t){var e=this.endWidth(i.clientWidth(),i.clientHeight());this.setWidth(t,e);var n=this.endHeight(i.clientWidth(),i.clientHeight());this.setHeight(t,n)},e.prototype.makeUsualStep=function(t){var e=this.endWidth(i.clientWidth(),i.clientHeight())-this.startWidth(i.clientWidth(),i.clientHeight()),n=i.castToInt(this.startWidth(i.clientWidth(),i.clientHeight())+e*t.delta);this.setWidth(t,n);var o=this.endHeight(i.clientWidth(),i.clientHeight())-this.startHeight(i.clientWidth(),i.clientHeight()),r=i.castToInt(this.startHeight(i.clientWidth(),i.clientHeight())+o*t.delta);this.setHeight(t,r)},e.prototype.turnOff=function(t){t.style.removeProperty("width"),t.style.removeProperty("height")},e}(M),Y=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),G=function(t){function e(e){var n=t.call(this)||this;return n.name="OpacityMotion",n.start=H.prepare(e.start),n.end=H.prepare(e.end),n}return Y(e,t),e.prototype.setOpacity=function(t,e){t.element.style.opacity=e.toString()},e.prototype.makeStartStep=function(t){var e=this.start(i.clientWidth(),i.clientHeight());this.setOpacity(t,e)},e.prototype.makeEndStep=function(t){var e=this.end(i.clientWidth(),i.clientHeight());this.setOpacity(t,e)},e.prototype.makeUsualStep=function(t){var e=this.end(i.clientWidth(),i.clientHeight())-this.start(i.clientWidth(),i.clientHeight()),n=this.start(i.clientWidth(),i.clientHeight())+e*t.delta;this.setOpacity(t,n)},e.prototype.turnOff=function(t){t.style.removeProperty("opacity")},e}(M),C=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),B=function(){return B=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},B.apply(this,arguments)},D=function(t){function e(e){var n=t.call(this)||this;return n.name="BoundMotion",n.before=e.before,n.after=e.after,n}return C(e,t),e.prototype.applyProperties=function(t,e){for(var n=0,i=Object.keys(e);n<i.length;n++){var o=i[n];t.style[o]=e[o]}},e.prototype.make=function(t){if(!t.element)throw new Error("There is no element");t.scrollPosOnScene<t.frame.getStartPos()?this.applyProperties(t.element,this.before(i.clientWidth(),i.clientHeight())):this.applyProperties(t.element,this.after(i.clientWidth(),i.clientHeight()))},e.prototype.turnOff=function(t){for(var e=0,n=Object.keys(B(B({},this.before(i.clientWidth(),i.clientHeight())),this.after(i.clientWidth(),i.clientHeight())));e<n.length;e++){var o=n[e];t.style.removeProperty(o)}},e}(k);function I(t){var e=[];return t.move&&e.push(new O(new x(t.move),t.start,t.end)),t.size&&e.push(new O(new T(t.size),t.start,t.end)),t.opacity&&e.push(new O(new G(t.opacity),t.start,t.end)),e}var V=function(){function t(){}return t.rootIs=function(t,e){return"rootKlass"in t&&t.rootKlass===e},t}(),K=function(t,e,n){if(n||2===arguments.length)for(var i,o=0,r=e.length;o<r;o++)!i&&o in e||(i||(i=Array.prototype.slice.call(e,0,o)),i[o]=e[o]);return t.concat(i||Array.prototype.slice.call(e))};function X(t){var e=new P(t.element,t.options);return t.frames&&e.add((Array.isArray(t.frames)?t.frames:[t.frames]).reduce((function(t,e){return V.rootIs(e,n.TimeFrame)?K(K([],t,!0),[e],!1):K(K([],t,!0),I(e),!0)}),[])),e}function N(t){var e=void 0===t.type||"sticky-platform"===t.type?new v(t.element,t.height,t.options):"fixed-actors"===t.type?new b(t.element,t.height,t.options):void 0;if(!e)throw new Error("There is no this type of scene");return t.actors&&e.add((Array.isArray(t.actors)?t.actors:[t.actors]).map((function(t){return V.rootIs(t,n.Actor)?t:X(t)}))),e}function U(t,e){return Array.isArray(t)?new a(t.map((function(t){return N(t)})),e):new a(N(t),e)}var Z=e.so,q=e.ko,J=e.FK,$=e.xy,Q=e.B6,tt=e.y_,et=e.yz,nt=e.Jj,it=e.Vi,ot=e.xs,rt=e.XC,st=e.Rp,ct=e.jL,lt=e.nv,at=e.Zr,ht=e.$K,ut=e.zk,pt=e.Ah,ft=e.KZ;export{Z as Ballet,q as BalletScrollSpeed,J as BoundMotion,$ as FixedActorsScene,Q as FramedMotion,tt as Motion,et as MoveMotion,nt as OpacityMotion,it as RefActor,ot as Scene,rt as SizeMotion,st as StaticActor,ct as StickyPlatformScene,lt as TimeFrame,at as Util,ht as actor,ut as ballet,pt as scene,ft as timeFrame}; | ||
//# sourceMappingURL=index.es.js.map |
import { Color } from './color.model'; | ||
import { Value } from './value.model'; | ||
export interface MeasuringSubgrid { | ||
@@ -9,3 +10,3 @@ width?: (gridWidth: number) => number; | ||
export interface MeasuringGridModel { | ||
width?: (deviceWidth: number, deviceHeight: number) => number; | ||
width?: Value; | ||
height?: (deviceWidth: number, deviceHeight: number, sceneHeight: number) => number; | ||
@@ -12,0 +13,0 @@ color: Color; |
import { TimeFrame } from '../time-frame'; | ||
import { Scene } from '../scenes/scene'; | ||
import { Scene, SceneOptions } from '../scenes/scene'; | ||
export interface MotionParams { | ||
@@ -9,3 +9,3 @@ scrollPosOnScene: number; | ||
frame: TimeFrame; | ||
scene: Scene<any>; | ||
scene: Scene<SceneOptions>; | ||
} |
import { MotionParams } from '../models/motion-params.model'; | ||
export declare abstract class Motion { | ||
import { Klass, RootKlassGuard } from '../models/rootKlassGuard'; | ||
export declare abstract class Motion implements RootKlassGuard { | ||
rootKlass: Klass; | ||
protected abstract readonly name: string; | ||
@@ -4,0 +6,0 @@ motionName(): string; |
import { Value } from '../models/value.model'; | ||
import { MotionParams } from '../models/motion-params.model'; | ||
import { FramedMotion } from './framed-motion'; | ||
import { NumOrFn } from '../models/num-or-fn'; | ||
export interface IMoveMotion { | ||
startX: Value; | ||
endX: Value; | ||
startY: Value; | ||
endY: Value; | ||
startX: NumOrFn; | ||
endX: NumOrFn; | ||
startY: NumOrFn; | ||
endY: NumOrFn; | ||
} | ||
@@ -10,0 +11,0 @@ export declare class MoveMotion extends FramedMotion { |
import { Value } from '../models/value.model'; | ||
import { MotionParams } from '../models/motion-params.model'; | ||
import { FramedMotion } from './framed-motion'; | ||
import { NumOrFn } from '../models/num-or-fn'; | ||
export interface IOpacityMotion { | ||
start: Value; | ||
end: Value; | ||
start: NumOrFn; | ||
end: NumOrFn; | ||
} | ||
@@ -8,0 +9,0 @@ export declare class OpacityMotion extends FramedMotion { |
import { Value } from '../models/value.model'; | ||
import { MotionParams } from '../models/motion-params.model'; | ||
import { FramedMotion } from './framed-motion'; | ||
import { NumOrFn } from '../models/num-or-fn'; | ||
export interface ISizeMotion { | ||
startWidth: Value; | ||
endWidth: Value; | ||
startHeight: Value; | ||
endHeight: Value; | ||
startWidth: NumOrFn; | ||
endWidth: NumOrFn; | ||
startHeight: NumOrFn; | ||
endHeight: NumOrFn; | ||
} | ||
@@ -10,0 +11,0 @@ export declare class SizeMotion extends FramedMotion { |
@@ -1,2 +0,2 @@ | ||
import { Actor } from '../actors/actor'; | ||
import { Actor, ActorOptions } from '../actors/actor'; | ||
import { Scene, SceneOptions } from './scene'; | ||
@@ -10,4 +10,4 @@ import { MotionParams } from '../models/motion-params.model'; | ||
protected turnOff(): void; | ||
protected placeActor(actor: Actor): void; | ||
protected placeActor(actor: Actor<ActorOptions>): void; | ||
interceptY(y: number, params: MotionParams): number; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { Actor } from '../actors/actor'; | ||
import { Actor, ActorOptions } from '../actors/actor'; | ||
import { MeasuringGrid } from '../measuring-grid'; | ||
@@ -6,2 +6,5 @@ import { MeasuringGridModel } from '../models/measuring-grid.model'; | ||
import { ResolutionModel } from '../models/resolution.model'; | ||
import { ElementRecognition } from '../models/element-recognition'; | ||
import { Klass, RootKlassGuard } from '../models/rootKlassGuard'; | ||
import { Value } from '../models/value.model'; | ||
export interface SceneOptions { | ||
@@ -12,7 +15,8 @@ offset?: (deviceWidth: number, deviceHeight: number, sceneHeight: number) => number; | ||
} | ||
export declare abstract class Scene<Options extends SceneOptions> { | ||
export declare abstract class Scene<Options extends SceneOptions> implements RootKlassGuard { | ||
protected height: Value; | ||
protected options?: Options | undefined; | ||
rootKlass: Klass; | ||
protected element: HTMLElement; | ||
protected height: (deviceWidth: number, deviceHeight: number) => number; | ||
protected options?: Options | undefined; | ||
protected _actors: Actor[]; | ||
protected _actors: Array<Actor<ActorOptions>>; | ||
abstract name: string; | ||
@@ -24,5 +28,6 @@ protected turnedOn: boolean; | ||
protected abstract platformHeight(deviceWidth: number, deviceHeight: number): number; | ||
protected abstract placeActor(actor: Actor): void; | ||
protected abstract placeActor(actor: Actor<ActorOptions>): void; | ||
protected grid: MeasuringGrid; | ||
constructor(element: HTMLElement, height: (deviceWidth: number, deviceHeight: number) => number, options?: Options | undefined); | ||
constructor(element: ElementRecognition, height: Value, options?: Options | undefined); | ||
private recognizeElement; | ||
protected setDefaults(): void; | ||
@@ -32,9 +37,9 @@ defaults(): SceneOptions; | ||
initMeasuringGrid(): void; | ||
platformHeightValue(): number; | ||
elementY(): number; | ||
platformHeightValue(): number; | ||
scrollPos(): number; | ||
elementHeight(): number; | ||
add(actor: Actor): void; | ||
add(actors: Actor<ActorOptions> | Array<Actor<ActorOptions>>): void; | ||
protected placeAllActors(): void; | ||
get actors(): Actor[]; | ||
get actors(): Array<Actor<ActorOptions>>; | ||
interceptY(y: number, params: MotionParams): number; | ||
@@ -41,0 +46,0 @@ redrawMeasuringGrid(): void; |
@@ -1,5 +0,6 @@ | ||
import { Actor } from '../actors/actor'; | ||
import { Actor, ActorOptions } from '../actors/actor'; | ||
import { Scene, SceneOptions } from './scene'; | ||
import { Value } from '../models/value.model'; | ||
export interface StickyPlatformSceneOptions extends SceneOptions { | ||
stickyPlatformHeight?: (deviceWidth: number, deviceHeight: number) => number; | ||
stickyPlatformHeight?: Value; | ||
} | ||
@@ -15,3 +16,3 @@ export declare class StickyPlatformScene extends Scene<StickyPlatformSceneOptions> { | ||
protected turnOff(): void; | ||
protected placeActor(actor: Actor): void; | ||
protected placeActor(actor: Actor<ActorOptions>): void; | ||
} |
import { Motion } from './motions/motion'; | ||
export declare class TimeFrame { | ||
import { Value } from './models/value.model'; | ||
import { Klass, RootKlassGuard } from './models/rootKlassGuard'; | ||
import { NumOrFn } from './models/num-or-fn'; | ||
export declare class TimeFrame implements RootKlassGuard { | ||
motion: Motion; | ||
start: (deviceWidth: number, deviceHeight: number) => number; | ||
end: (deviceWidth: number, deviceHeight: number) => number; | ||
constructor(motion: Motion, start: (deviceWidth: number, deviceHeight: number) => number, end?: (deviceWidth: number, deviceHeight: number) => number); | ||
rootKlass: Klass; | ||
start: Value; | ||
end: Value; | ||
constructor(motion: Motion, start?: NumOrFn, end?: NumOrFn); | ||
getStartPos(): number; | ||
@@ -8,0 +12,0 @@ getEndPos(): number; |
import { WindowSizesModel } from './models/window-sizes.model'; | ||
import { MotionParams } from './models/motion-params.model'; | ||
import { TimeFrame } from './time-frame'; | ||
import { Scene } from './scenes/scene'; | ||
import { Scene, SceneOptions } from './scenes/scene'; | ||
export declare class Util { | ||
@@ -27,5 +27,5 @@ static castToInt(num: number): number; | ||
static documentHeight(): number; | ||
static prepareMotionParams(scrollPosOnScene: number, element: HTMLElement, frame: TimeFrame, scene: Scene<any>): MotionParams; | ||
static prepareMotionParams(scrollPosOnScene: number, element: HTMLElement, frame: TimeFrame, scene: Scene<SceneOptions>): MotionParams; | ||
static windowSizes(): WindowSizesModel; | ||
static logWindowSizes(): void; | ||
} |
{ | ||
"name": "ballet", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"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
131321
46
635