diff --git a/dist/slotmachine.js b/dist/slotmachine.js index 260b082..5e560ea 100644 --- a/dist/slotmachine.js +++ b/dist/slotmachine.js @@ -306,7 +306,7 @@ class SlotMachine { this.changeSettings({ ...defaults, ...options }); this._setBounds(); this._resetPosition(); - if (this.auto !== false) { + if (this.auto) { this.run(); } } diff --git a/dist/slotmachine.js.map b/dist/slotmachine.js.map index 01fc04c..139956a 100644 --- a/dist/slotmachine.js.map +++ b/dist/slotmachine.js.map @@ -1 +1 @@ -{"version":3,"file":"slotmachine.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;ACVA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;;;;;;;;ACnCA,UAAU,mBAAO,CAAC,EAAiB;AACnC,2CAA2C,qBAAM;AACjD;AACA;AACA;AACA;;AAEA,eAAe,4BAA4B;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,eAAe;AACtC;AACA;AACA;AACA,cAAc;AACd,sCAAsC,SAAS;AAC/C;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA,mBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;;;;;;;UC1EA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WAC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AAE,KAAK,CAAC,CAAC;QAEV,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,GAAG;QACD,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAO;SACR;QAED,IAAI,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,GAAG,EAAE;YAC3B,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE;gBAC7C,OAAG,CAAC,GAAG,EAAE;oBACP,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACtB,CAAC,EAAE,GAAG,CAAC,CAAC;aACT;iBAAM;gBACL,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;oBAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACtB,CAAC,CAAC,CAAC;aACJ;QACH,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;QAI5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;CACF;;;ACpdwC;AAEzC,0CAAe,WAAW,EAAC","sources":["webpack://SlotMachine/webpack/universalModuleDefinition","webpack://SlotMachine/./node_modules/performance-now/lib/performance-now.js","webpack://SlotMachine/./node_modules/raf/index.js","webpack://SlotMachine/webpack/bootstrap","webpack://SlotMachine/webpack/runtime/compat get default export","webpack://SlotMachine/webpack/runtime/define property getters","webpack://SlotMachine/webpack/runtime/global","webpack://SlotMachine/webpack/runtime/hasOwnProperty shorthand","webpack://SlotMachine/./lib/raf.ts","webpack://SlotMachine/./lib/timer.ts","webpack://SlotMachine/./lib/slot-machine.ts","webpack://SlotMachine/./lib/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SlotMachine\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SlotMachine\"] = factory();\n\telse\n\t\troot[\"SlotMachine\"] = factory();\n})(self, () => {\nreturn ","// Generated by CoffeeScript 1.12.2\n(function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n\n if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return new Date().getTime() - loadTime;\n };\n loadTime = new Date().getTime();\n }\n\n}).call(this);\n\n//# sourceMappingURL=performance-now.js.map\n","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import requestAnimationFrame from 'raf';\nimport { Callback } from './types';\n\nexport default function raf(cb: Callback, timeout = 0) {\n setTimeout(() => requestAnimationFrame(cb), timeout);\n}\n","import { Callback } from './types';\n\nexport default class Timer {\n cb: Callback;\n initialDelay: number;\n delay: number;\n startTime: number;\n timer: NodeJS.Timeout;\n running: boolean;\n\n constructor(cb: Callback, delay: number) {\n this.cb = cb;\n this.initialDelay = delay;\n this.delay = delay;\n this.running = false;\n\n this.resume();\n\n return this;\n }\n\n _start() {\n this.timer = setTimeout(() => {\n this.running = false;\n this.cb(this);\n }, this.delay);\n }\n\n cancel() {\n this.running = false;\n clearTimeout(this.timer);\n }\n\n pause() {\n if (this.running) {\n this.delay -= new Date().getTime() - this.startTime;\n this.cancel();\n }\n }\n\n resume() {\n if (!this.running) {\n this.running = true;\n this.startTime = new Date().getTime();\n\n this._start();\n }\n }\n\n reset() {\n this.cancel();\n this.delay = this.initialDelay;\n this._start();\n }\n\n add(extraDelay: number) {\n this.pause();\n this.delay += extraDelay;\n this.resume();\n }\n}\n","import raf from './raf';\nimport Timer from './timer';\n\nexport type RandomizeCallback = (active: number) => number;\nexport type OnCompleteCallback = (active: number) => any;\n\nexport type Direction = 'up' | 'down';\n\nexport type Bound = {\n key: Direction;\n initial: number;\n first: number;\n last: number;\n to: number;\n firstToLast: number;\n lastToFirst: number;\n};\n\nexport type Bounds = Record;\n\nexport type Options = {\n active: number;\n delay: number;\n auto: boolean;\n spins: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport: boolean;\n direction: Direction;\n transition: string;\n};\n\nconst defaults: Options = {\n active: 0, // Active element [Number]\n delay: 200, // Animation time [Number]\n auto: false, // Repeat delay [false||Number]\n spins: 5, // Number of spins when auto [Number]\n randomize: undefined, // Randomize function, must return a number with the selected position\n onComplete: undefined, // Callback function(result)\n inViewport: true, // Stops animations if the element isn´t visible on the screen\n direction: 'up', // Animation direction ['up'||'down']\n transition: 'ease-in-out',\n};\n\nexport enum FX {\n NO_TRANSITION = 'slotMachineNoTransition',\n FAST = 'slotMachineBlurFast',\n NORMAL = 'slotMachineBlurMedium',\n SLOW = 'slotMachineBlurSlow',\n TURTLE = 'slotMachineBlurTurtle',\n GRADIENT = 'slotMachineGradient',\n STOP = 'slotMachineGradient',\n}\n\nexport default class SlotMachine implements Options {\n container: HTMLElement;\n element: HTMLElement;\n tiles: HTMLElement[];\n running: boolean;\n stopping: boolean;\n nextActive?: number;\n\n // options\n delay: number;\n auto: boolean;\n spins: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport: boolean;\n\n private _active: number;\n private _minTop: number;\n private _maxTop: number;\n private _fakeFirstTile: HTMLElement;\n private _fakeLastTile: HTMLElement;\n private _bounds: Bounds;\n private _direction: Direction;\n private _transition: string;\n private _timer: Timer;\n\n constructor(element: HTMLElement, options: Options) {\n this.element = element;\n // Slot Machine elements\n this.tiles = [].slice.call(this.element.children) as HTMLElement[];\n // Machine is running?\n this.running = false;\n // Machine is stopping?\n this.stopping = false;\n // Disable overflow\n this.element.style.overflow = 'hidden';\n // Wrap elements inside container\n this._wrapTiles();\n // Set min top offset\n this._minTop = -this._fakeFirstTile.offsetHeight;\n // Set max top offset\n this._maxTop = -this.tiles.reduce((acc, tile) => acc + tile.offsetHeight, 0);\n // Call setters if neccesary\n this.changeSettings({ ...defaults, ...options });\n // Initialize spin direction [up, down]\n this._setBounds();\n // Show active element\n this._resetPosition();\n // Start auto animation\n if (this.auto !== false) {\n this.run();\n }\n }\n\n changeSettings(options: Options) {\n Object.keys(options).forEach((key) => {\n // Trigger setters\n this[key] = options[key];\n });\n }\n\n _wrapTiles() {\n this.container = document.createElement('div');\n this.container.classList.add('slotMachineContainer');\n this.container.style.transition = '1s ease-in-out';\n this.element.appendChild(this.container);\n\n this._fakeFirstTile = this.tiles[this.tiles.length - 1].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeFirstTile);\n\n this.tiles.forEach((tile) => {\n this.container.appendChild(tile);\n });\n\n this._fakeLastTile = this.tiles[0].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeLastTile);\n }\n\n _setBounds() {\n const initial = this.getTileOffset(this.active);\n const first = this.getTileOffset(this.tiles.length);\n const last = this.getTileOffset(this.tiles.length);\n\n this._bounds = {\n up: {\n key: 'up',\n initial,\n first: 0,\n last,\n to: this._maxTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n down: {\n key: 'down',\n initial,\n first,\n last: 0,\n to: this._minTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n };\n }\n\n get active() {\n return this._active;\n }\n\n set active(index: number) {\n if (index < 0 || index >= this.tiles.length || isNaN(index)) {\n index = 0;\n }\n\n this._active = index;\n }\n\n get direction() {\n return this._direction;\n }\n\n set direction(direction: Direction) {\n if (this.running) {\n return;\n }\n\n this._direction = direction === 'down' ? 'down' : 'up';\n }\n\n get bounds() {\n return this._bounds[this._direction];\n }\n\n get transition() {\n return this._transition;\n }\n\n set transition(transition: string) {\n this._transition = transition || 'ease-in-out';\n }\n\n get visibleTile() {\n const firstTileHeight = this.tiles[0].offsetHeight;\n const rawContainerMargin = this.container.style.transform || '';\n const matrixRegExp = /^matrix\\(-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?(-?\\d+)\\)$/;\n const containerMargin = parseInt(rawContainerMargin.replace(matrixRegExp, '$1'), 10);\n\n return Math.abs(Math.round(containerMargin / firstTileHeight)) - 1;\n }\n\n get random() {\n return Math.floor(Math.random() * this.tiles.length);\n }\n\n get custom() {\n let choosen = this.random;\n\n if (this.randomize) {\n let index = this.randomize(this.active);\n if (index < 0 || index >= this.tiles.length) {\n index = 0;\n }\n choosen = index;\n }\n\n return choosen;\n }\n\n get _prevIndex() {\n const prevIndex = this.active - 1;\n\n return prevIndex < 0 ? this.tiles.length - 1 : prevIndex;\n }\n\n get _nextIndex() {\n const nextIndex = this.active + 1;\n\n return nextIndex < this.tiles.length ? nextIndex : 0;\n }\n\n get prevIndex() {\n return this.direction === 'up' ? this._nextIndex : this._prevIndex;\n }\n\n get nextIndex() {\n return this.direction === 'up' ? this._prevIndex : this._nextIndex;\n }\n\n get visible() {\n const rect = this.element.getBoundingClientRect();\n const windowHeight = window.innerHeight || document.documentElement.clientHeight;\n const windowWidth = window.innerWidth || document.documentElement.clientWidth;\n const vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;\n const horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;\n\n return vertInView && horInView;\n }\n\n set _animationFX(effect: FX) {\n const delay = this.delay / 4;\n\n raf(() => {\n [...this.tiles, this._fakeLastTile, this._fakeFirstTile].forEach((tile) => {\n tile.classList.remove(FX.FAST, FX.NORMAL, FX.SLOW, FX.TURTLE);\n if (effect !== FX.STOP) {\n tile.classList.add(effect);\n }\n });\n\n if (effect === FX.STOP) {\n this.container.classList.remove(FX.GRADIENT);\n } else {\n this.container.classList.add(FX.GRADIENT);\n }\n }, delay);\n }\n\n _changeTransition(delay = this.delay, transition = this.transition) {\n this.container.style.transition = `${delay / 1000}s ${transition}`;\n }\n\n _changeTransform(margin: number) {\n this.container.style.transform = `matrix(1, 0, 0, 1, 0, ${margin})`;\n }\n\n _isGoingBackward() {\n return !!(\n this.active === 0 &&\n this.nextActive === this.tiles.length - 1\n );\n }\n\n _isGoingForward() {\n return !!(\n this.active === this.tiles.length - 1 &&\n this.nextActive === 0\n );\n }\n\n getTileOffset(index: number) {\n let offset = 0;\n\n for (let i = 0; i < index; i++) {\n offset += this.tiles[i].offsetHeight;\n }\n\n return this._minTop - offset;\n }\n\n _resetPosition(margin?: number) {\n this.container.classList.toggle(FX.NO_TRANSITION);\n this._changeTransform(margin !== undefined ? margin : this.bounds.initial);\n // Force reflow, flushing the CSS changes\n this.container.offsetHeight;\n this.container.classList.toggle(FX.NO_TRANSITION);\n }\n\n next() {\n this.direction = 'down';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n prev() {\n this.direction = 'up';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n _getDelayFromSpins(spins: number) {\n let delay = this.delay;\n this.transition = 'linear';\n\n switch (spins) {\n case 1:\n delay /= 0.5;\n this.transition = 'ease-out';\n this._animationFX = FX.TURTLE;\n break;\n case 2:\n delay /= 0.75;\n this._animationFX = FX.SLOW;\n break;\n case 3:\n delay /= 1;\n this._animationFX = FX.NORMAL;\n break;\n case 4:\n delay /= 1.25;\n this._animationFX = FX.NORMAL;\n break;\n default:\n delay /= 1.5;\n this._animationFX = FX.FAST;\n }\n\n return delay;\n }\n\n shuffle(spins: number, onComplete: OnCompleteCallback) {\n // Make spins optional\n if (typeof spins === 'function') {\n onComplete = spins;\n }\n this.running = true;\n // Perform animation\n if (!this.visible && this.inViewport === true) {\n this.stop(onComplete);\n } else {\n const delay = this._getDelayFromSpins(spins);\n // this.delay = delay;\n this._changeTransition(delay);\n this._changeTransform(this.bounds.to);\n raf(() => {\n if (!this.stopping && this.running) {\n const left = spins - 1;\n\n this._resetPosition(this.bounds.first);\n\n if (left > 1) {\n // Repeat animation\n this.shuffle(left, onComplete);\n } else {\n this.stop(onComplete);\n }\n }\n }, delay);\n }\n\n return this.nextActive;\n }\n\n stop(onStop?: OnCompleteCallback) {\n if (!this.running || this.stopping) {\n return this.nextActive;\n }\n\n this.running = true;\n this.stopping = true;\n\n if (!Number.isInteger(this.nextActive)) {\n // Get random or custom element\n this.nextActive = this.custom;\n }\n\n // Check direction to prevent jumping\n if (this._isGoingBackward()) {\n this._resetPosition(this.bounds.firstToLast);\n } else if (this._isGoingForward()) {\n this._resetPosition(this.bounds.lastToFirst);\n }\n\n // Update last choosen element index\n this.active = this.nextActive as number;\n\n // Perform animation\n const delay = this._getDelayFromSpins(1);\n // this.delay = delay;\n this._changeTransition(delay);\n this._animationFX = FX.STOP;\n this._changeTransform(this.getTileOffset(this.active));\n raf(() => {\n this.stopping = false;\n this.running = false;\n this.nextActive = undefined;\n\n if (typeof this.onComplete === 'function') {\n this.onComplete(this.active);\n }\n\n if (typeof onStop === 'function') {\n onStop.apply(this, [this.active]);\n }\n }, delay);\n\n return this.active;\n }\n\n run() {\n if (this.running) {\n return;\n }\n\n this._timer = new Timer(() => {\n if (!this.visible && this.inViewport === true) {\n raf(() => {\n this._timer.reset();\n }, 500);\n } else {\n this.shuffle(this.spins, () => {\n this._timer.reset();\n });\n }\n }, this.delay);\n }\n\n destroy() {\n this._fakeFirstTile.remove();\n this._fakeLastTile.remove();\n // this.$tiles.unwrap();\n\n // Unwrap tiles\n this.tiles.forEach((tile) => {\n this.element.appendChild(tile);\n });\n\n this.container.remove();\n }\n}\n","import SlotMachine from './slot-machine';\n\nexport default SlotMachine;\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"slotmachine.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;;;;;;ACVA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA,IAAI;AACJ;AACA;AACA;AACA;AACA;;AAEA,CAAC;;AAED;;;;;;;;ACnCA,UAAU,mBAAO,CAAC,EAAiB;AACnC,2CAA2C,qBAAM;AACjD;AACA;AACA;AACA;;AAEA,eAAe,4BAA4B;AAC3C;AACA;AACA;AACA;;AAEA;AACA;A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AO,CAAC,CAAC,IAAI,EAAE,EAAE;YAC1B,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;CACF;;;ACpdwC;AAEzC,0CAAe,WAAW,EAAC","sources":["webpack://SlotMachine/webpack/universalModuleDefinition","webpack://SlotMachine/./node_modules/performance-now/lib/performance-now.js","webpack://SlotMachine/./node_modules/raf/index.js","webpack://SlotMachine/webpack/bootstrap","webpack://SlotMachine/webpack/runtime/compat get default export","webpack://SlotMachine/webpack/runtime/define property getters","webpack://SlotMachine/webpack/runtime/global","webpack://SlotMachine/webpack/runtime/hasOwnProperty shorthand","webpack://SlotMachine/./lib/raf.ts","webpack://SlotMachine/./lib/timer.ts","webpack://SlotMachine/./lib/slot-machine.ts","webpack://SlotMachine/./lib/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SlotMachine\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SlotMachine\"] = factory();\n\telse\n\t\troot[\"SlotMachine\"] = factory();\n})(self, () => {\nreturn ","// Generated by CoffeeScript 1.12.2\n(function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n\n if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return new Date().getTime() - loadTime;\n };\n loadTime = new Date().getTime();\n }\n\n}).call(this);\n\n//# sourceMappingURL=performance-now.js.map\n","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import requestAnimationFrame from 'raf';\nimport { Callback } from './types';\n\nexport default function raf(cb: Callback, timeout = 0) {\n setTimeout(() => requestAnimationFrame(cb), timeout);\n}\n","import { Callback } from './types';\n\nexport default class Timer {\n cb: Callback;\n initialDelay: number;\n delay: number;\n startTime: number;\n timer: NodeJS.Timeout;\n running: boolean;\n\n constructor(cb: Callback, delay: number) {\n this.cb = cb;\n this.initialDelay = delay;\n this.delay = delay;\n this.running = false;\n\n this.resume();\n\n return this;\n }\n\n _start() {\n this.timer = setTimeout(() => {\n this.running = false;\n this.cb(this);\n }, this.delay);\n }\n\n cancel() {\n this.running = false;\n clearTimeout(this.timer);\n }\n\n pause() {\n if (this.running) {\n this.delay -= new Date().getTime() - this.startTime;\n this.cancel();\n }\n }\n\n resume() {\n if (!this.running) {\n this.running = true;\n this.startTime = new Date().getTime();\n\n this._start();\n }\n }\n\n reset() {\n this.cancel();\n this.delay = this.initialDelay;\n this._start();\n }\n\n add(extraDelay: number) {\n this.pause();\n this.delay += extraDelay;\n this.resume();\n }\n}\n","import raf from './raf';\nimport Timer from './timer';\n\nexport type RandomizeCallback = (active: number) => number;\nexport type OnCompleteCallback = (active: number) => any;\n\nexport type Direction = 'up' | 'down';\n\nexport type Bound = {\n key: Direction;\n initial: number;\n first: number;\n last: number;\n to: number;\n firstToLast: number;\n lastToFirst: number;\n};\n\nexport type Bounds = Record;\n\nexport type Options = {\n active?: number;\n delay?: number;\n auto?: boolean;\n spins?: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport?: boolean;\n direction?: Direction;\n transition?: string;\n};\n\nconst defaults: Options = {\n active: 0, // Active element [Number]\n delay: 200, // Animation time [Number]\n auto: false, // Repeat delay [false||Number]\n spins: 5, // Number of spins when auto [Number]\n randomize: undefined, // Randomize function, must return a number with the selected position\n onComplete: undefined, // Callback function(result)\n inViewport: true, // Stops animations if the element isn´t visible on the screen\n direction: 'up', // Animation direction ['up'||'down']\n transition: 'ease-in-out',\n};\n\nexport enum FX {\n NO_TRANSITION = 'slotMachineNoTransition',\n FAST = 'slotMachineBlurFast',\n NORMAL = 'slotMachineBlurMedium',\n SLOW = 'slotMachineBlurSlow',\n TURTLE = 'slotMachineBlurTurtle',\n GRADIENT = 'slotMachineGradient',\n STOP = 'slotMachineGradient',\n}\n\nexport default class SlotMachine implements Options {\n container: HTMLElement;\n element: HTMLElement;\n tiles: HTMLElement[];\n running: boolean;\n stopping: boolean;\n nextActive?: number;\n\n // options\n delay: number;\n auto: boolean;\n spins: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport: boolean;\n\n private _active: number;\n private _minTop: number;\n private _maxTop: number;\n private _fakeFirstTile: HTMLElement;\n private _fakeLastTile: HTMLElement;\n private _bounds: Bounds;\n private _direction: Direction;\n private _transition: string;\n private _timer: Timer;\n\n constructor(element: HTMLElement, options: Options) {\n this.element = element;\n // Slot Machine elements\n this.tiles = [].slice.call(this.element.children) as HTMLElement[];\n // Machine is running?\n this.running = false;\n // Machine is stopping?\n this.stopping = false;\n // Disable overflow\n this.element.style.overflow = 'hidden';\n // Wrap elements inside container\n this._wrapTiles();\n // Set min top offset\n this._minTop = -this._fakeFirstTile.offsetHeight;\n // Set max top offset\n this._maxTop = -this.tiles.reduce((acc, tile) => acc + tile.offsetHeight, 0);\n // Call setters if neccesary\n this.changeSettings({ ...defaults, ...options });\n // Initialize spin direction [up, down]\n this._setBounds();\n // Show active element\n this._resetPosition();\n // Start auto animation\n if (this.auto) {\n this.run();\n }\n }\n\n changeSettings(options: Options) {\n Object.keys(options).forEach((key) => {\n // Trigger setters\n this[key] = options[key]; /* @ts-ignore */\n });\n }\n\n _wrapTiles() {\n this.container = document.createElement('div');\n this.container.classList.add('slotMachineContainer');\n this.container.style.transition = '1s ease-in-out';\n this.element.appendChild(this.container);\n\n this._fakeFirstTile = this.tiles[this.tiles.length - 1].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeFirstTile);\n\n this.tiles.forEach((tile) => {\n this.container.appendChild(tile);\n });\n\n this._fakeLastTile = this.tiles[0].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeLastTile);\n }\n\n _setBounds() {\n const initial = this.getTileOffset(this.active);\n const first = this.getTileOffset(this.tiles.length);\n const last = this.getTileOffset(this.tiles.length);\n\n this._bounds = {\n up: {\n key: 'up',\n initial,\n first: 0,\n last,\n to: this._maxTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n down: {\n key: 'down',\n initial,\n first,\n last: 0,\n to: this._minTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n };\n }\n\n get active() {\n return this._active;\n }\n\n set active(index: number) {\n if (index < 0 || index >= this.tiles.length || isNaN(index)) {\n index = 0;\n }\n\n this._active = index;\n }\n\n get direction() {\n return this._direction;\n }\n\n set direction(direction: Direction) {\n if (this.running) {\n return;\n }\n\n this._direction = direction === 'down' ? 'down' : 'up';\n }\n\n get bounds() {\n return this._bounds[this._direction];\n }\n\n get transition() {\n return this._transition;\n }\n\n set transition(transition: string) {\n this._transition = transition || 'ease-in-out';\n }\n\n get visibleTile() {\n const firstTileHeight = this.tiles[0].offsetHeight;\n const rawContainerMargin = this.container.style.transform || '';\n const matrixRegExp = /^matrix\\(-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?(-?\\d+)\\)$/;\n const containerMargin = parseInt(rawContainerMargin.replace(matrixRegExp, '$1'), 10);\n\n return Math.abs(Math.round(containerMargin / firstTileHeight)) - 1;\n }\n\n get random() {\n return Math.floor(Math.random() * this.tiles.length);\n }\n\n get custom() {\n let choosen = this.random;\n\n if (this.randomize) {\n let index = this.randomize(this.active);\n if (index < 0 || index >= this.tiles.length) {\n index = 0;\n }\n choosen = index;\n }\n\n return choosen;\n }\n\n get _prevIndex() {\n const prevIndex = this.active - 1;\n\n return prevIndex < 0 ? this.tiles.length - 1 : prevIndex;\n }\n\n get _nextIndex() {\n const nextIndex = this.active + 1;\n\n return nextIndex < this.tiles.length ? nextIndex : 0;\n }\n\n get prevIndex() {\n return this.direction === 'up' ? this._nextIndex : this._prevIndex;\n }\n\n get nextIndex() {\n return this.direction === 'up' ? this._prevIndex : this._nextIndex;\n }\n\n get visible() {\n const rect = this.element.getBoundingClientRect();\n const windowHeight = window.innerHeight || document.documentElement.clientHeight;\n const windowWidth = window.innerWidth || document.documentElement.clientWidth;\n const vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;\n const horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;\n\n return vertInView && horInView;\n }\n\n set _animationFX(effect: FX) {\n const delay = this.delay / 4;\n\n raf(() => {\n [...this.tiles, this._fakeLastTile, this._fakeFirstTile].forEach((tile) => {\n tile.classList.remove(FX.FAST, FX.NORMAL, FX.SLOW, FX.TURTLE);\n if (effect !== FX.STOP) {\n tile.classList.add(effect);\n }\n });\n\n if (effect === FX.STOP) {\n this.container.classList.remove(FX.GRADIENT);\n } else {\n this.container.classList.add(FX.GRADIENT);\n }\n }, delay);\n }\n\n _changeTransition(delay = this.delay, transition = this.transition) {\n this.container.style.transition = `${delay / 1000}s ${transition}`;\n }\n\n _changeTransform(margin: number) {\n this.container.style.transform = `matrix(1, 0, 0, 1, 0, ${margin})`;\n }\n\n _isGoingBackward() {\n return !!(\n this.active === 0 &&\n this.nextActive === this.tiles.length - 1\n );\n }\n\n _isGoingForward() {\n return !!(\n this.active === this.tiles.length - 1 &&\n this.nextActive === 0\n );\n }\n\n getTileOffset(index: number) {\n let offset = 0;\n\n for (let i = 0; i < index; i++) {\n offset += this.tiles[i].offsetHeight;\n }\n\n return this._minTop - offset;\n }\n\n _resetPosition(margin?: number) {\n this.container.classList.toggle(FX.NO_TRANSITION);\n this._changeTransform(margin !== undefined ? margin : this.bounds.initial);\n // Force reflow, flushing the CSS changes\n this.container.offsetHeight;\n this.container.classList.toggle(FX.NO_TRANSITION);\n }\n\n next() {\n this.direction = 'down';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n prev() {\n this.direction = 'up';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n _getDelayFromSpins(spins: number) {\n let delay = this.delay;\n this.transition = 'linear';\n\n switch (spins) {\n case 1:\n delay /= 0.5;\n this.transition = 'ease-out';\n this._animationFX = FX.TURTLE;\n break;\n case 2:\n delay /= 0.75;\n this._animationFX = FX.SLOW;\n break;\n case 3:\n delay /= 1;\n this._animationFX = FX.NORMAL;\n break;\n case 4:\n delay /= 1.25;\n this._animationFX = FX.NORMAL;\n break;\n default:\n delay /= 1.5;\n this._animationFX = FX.FAST;\n }\n\n return delay;\n }\n\n shuffle(spins: number, onComplete: OnCompleteCallback) {\n // Make spins optional\n if (typeof spins === 'function') {\n onComplete = spins;\n }\n this.running = true;\n // Perform animation\n if (!this.visible && this.inViewport === true) {\n this.stop(onComplete);\n } else {\n const delay = this._getDelayFromSpins(spins);\n // this.delay = delay;\n this._changeTransition(delay);\n this._changeTransform(this.bounds.to);\n raf(() => {\n if (!this.stopping && this.running) {\n const left = spins - 1;\n\n this._resetPosition(this.bounds.first);\n\n if (left > 1) {\n // Repeat animation\n this.shuffle(left, onComplete);\n } else {\n this.stop(onComplete);\n }\n }\n }, delay);\n }\n\n return this.nextActive;\n }\n\n stop(onStop?: OnCompleteCallback) {\n if (!this.running || this.stopping) {\n return this.nextActive;\n }\n\n this.running = true;\n this.stopping = true;\n\n if (!Number.isInteger(this.nextActive)) {\n // Get random or custom element\n this.nextActive = this.custom;\n }\n\n // Check direction to prevent jumping\n if (this._isGoingBackward()) {\n this._resetPosition(this.bounds.firstToLast);\n } else if (this._isGoingForward()) {\n this._resetPosition(this.bounds.lastToFirst);\n }\n\n // Update last choosen element index\n this.active = this.nextActive as number;\n\n // Perform animation\n const delay = this._getDelayFromSpins(1);\n // this.delay = delay;\n this._changeTransition(delay);\n this._animationFX = FX.STOP;\n this._changeTransform(this.getTileOffset(this.active));\n raf(() => {\n this.stopping = false;\n this.running = false;\n this.nextActive = undefined;\n\n if (typeof this.onComplete === 'function') {\n this.onComplete(this.active);\n }\n\n if (typeof onStop === 'function') {\n onStop.apply(this, [this.active]);\n }\n }, delay);\n\n return this.active;\n }\n\n run() {\n if (this.running) {\n return;\n }\n\n this._timer = new Timer(() => {\n if (!this.visible && this.inViewport === true) {\n raf(() => {\n this._timer.reset();\n }, 500);\n } else {\n this.shuffle(this.spins, () => {\n this._timer.reset();\n });\n }\n }, this.delay);\n }\n\n destroy() {\n this._fakeFirstTile.remove();\n this._fakeLastTile.remove();\n // this.$tiles.unwrap();\n\n // Unwrap tiles\n this.tiles.forEach((tile) => {\n this.element.appendChild(tile);\n });\n\n this.container.remove();\n }\n}\n","import SlotMachine from './slot-machine';\n\nexport default SlotMachine;\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/dist/slotmachine.min.js b/dist/slotmachine.min.js index ffa5697..380d31b 100644 --- a/dist/slotmachine.min.js +++ b/dist/slotmachine.min.js @@ -1,2 +1,2 @@ -!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define("SlotMachine",[],i):"object"==typeof exports?exports.SlotMachine=i():t.SlotMachine=i()}(self,(()=>(()=>{var t={75:function(t){(function(){var i,e,s,n,r,o;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(i()-r)/1e6},e=process.hrtime,n=(i=function(){var t;return 1e9*(t=e())[0]+t[1]})(),o=1e9*process.uptime(),r=n-o):Date.now?(t.exports=function(){return Date.now()-s},s=Date.now()):(t.exports=function(){return(new Date).getTime()-s},s=(new Date).getTime())}).call(this)},87:(t,i,e)=>{for(var s=e(75),n="undefined"==typeof window?e.g:window,r=["moz","webkit"],o="AnimationFrame",h=n["request"+o],a=n["cancel"+o]||n["cancelRequest"+o],l=0;!h&&l{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i);var s={};return(()=>{"use strict";e.d(s,{default:()=>a});var t=e(87),i=e.n(t);function n(t,e=0){setTimeout((()=>i()(t)),e)}class r{constructor(t,i){return this.cb=t,this.initialDelay=i,this.delay=i,this.running=!1,this.resume(),this}_start(){this.timer=setTimeout((()=>{this.running=!1,this.cb(this)}),this.delay)}cancel(){this.running=!1,clearTimeout(this.timer)}pause(){this.running&&(this.delay-=(new Date).getTime()-this.startTime,this.cancel())}resume(){this.running||(this.running=!0,this.startTime=(new Date).getTime(),this._start())}reset(){this.cancel(),this.delay=this.initialDelay,this._start()}add(t){this.pause(),this.delay+=t,this.resume()}}const o={active:0,delay:200,auto:!1,spins:5,randomize:void 0,onComplete:void 0,inViewport:!0,direction:"up",transition:"ease-in-out"};var h;!function(t){t.NO_TRANSITION="slotMachineNoTransition",t.FAST="slotMachineBlurFast",t.NORMAL="slotMachineBlurMedium",t.SLOW="slotMachineBlurSlow",t.TURTLE="slotMachineBlurTurtle",t.GRADIENT="slotMachineGradient",t.STOP="slotMachineGradient"}(h||(h={}));const a=class{constructor(t,i){this.element=t,this.tiles=[].slice.call(this.element.children),this.running=!1,this.stopping=!1,this.element.style.overflow="hidden",this._wrapTiles(),this._minTop=-this._fakeFirstTile.offsetHeight,this._maxTop=-this.tiles.reduce(((t,i)=>t+i.offsetHeight),0),this.changeSettings({...o,...i}),this._setBounds(),this._resetPosition(),!1!==this.auto&&this.run()}changeSettings(t){Object.keys(t).forEach((i=>{this[i]=t[i]}))}_wrapTiles(){this.container=document.createElement("div"),this.container.classList.add("slotMachineContainer"),this.container.style.transition="1s ease-in-out",this.element.appendChild(this.container),this._fakeFirstTile=this.tiles[this.tiles.length-1].cloneNode(!0),this.container.appendChild(this._fakeFirstTile),this.tiles.forEach((t=>{this.container.appendChild(t)})),this._fakeLastTile=this.tiles[0].cloneNode(!0),this.container.appendChild(this._fakeLastTile)}_setBounds(){const t=this.getTileOffset(this.active),i=this.getTileOffset(this.tiles.length),e=this.getTileOffset(this.tiles.length);this._bounds={up:{key:"up",initial:t,first:0,last:e,to:this._maxTop,firstToLast:e,lastToFirst:0},down:{key:"down",initial:t,first:i,last:0,to:this._minTop,firstToLast:e,lastToFirst:0}}}get active(){return this._active}set active(t){(t<0||t>=this.tiles.length||isNaN(t))&&(t=0),this._active=t}get direction(){return this._direction}set direction(t){this.running||(this._direction="down"===t?"down":"up")}get bounds(){return this._bounds[this._direction]}get transition(){return this._transition}set transition(t){this._transition=t||"ease-in-out"}get visibleTile(){const t=this.tiles[0].offsetHeight,i=this.container.style.transform||"",e=parseInt(i.replace(/^matrix\(-?\d+,\s?-?\d+,\s?-?\d+,\s?-?\d+,\s?-?\d+,\s?(-?\d+)\)$/,"$1"),10);return Math.abs(Math.round(e/t))-1}get random(){return Math.floor(Math.random()*this.tiles.length)}get custom(){let t=this.random;if(this.randomize){let i=this.randomize(this.active);(i<0||i>=this.tiles.length)&&(i=0),t=i}return t}get _prevIndex(){const t=this.active-1;return t<0?this.tiles.length-1:t}get _nextIndex(){const t=this.active+1;return t=0,n=t.left<=e&&t.left+t.width>=0;return s&&n}set _animationFX(t){n((()=>{[...this.tiles,this._fakeLastTile,this._fakeFirstTile].forEach((i=>{i.classList.remove(h.FAST,h.NORMAL,h.SLOW,h.TURTLE),t!==h.STOP&&i.classList.add(t)})),t===h.STOP?this.container.classList.remove(h.GRADIENT):this.container.classList.add(h.GRADIENT)}),this.delay/4)}_changeTransition(t=this.delay,i=this.transition){this.container.style.transition=`${t/1e3}s ${i}`}_changeTransform(t){this.container.style.transform=`matrix(1, 0, 0, 1, 0, ${t})`}_isGoingBackward(){return!(0!==this.active||this.nextActive!==this.tiles.length-1)}_isGoingForward(){return!(this.active!==this.tiles.length-1||0!==this.nextActive)}getTileOffset(t){let i=0;for(let e=0;e{if(!this.stopping&&this.running){const e=t-1;this._resetPosition(this.bounds.first),e>1?this.shuffle(e,i):this.stop(i)}}),e)}else this.stop(i);return this.nextActive}stop(t){if(!this.running||this.stopping)return this.nextActive;this.running=!0,this.stopping=!0,Number.isInteger(this.nextActive)||(this.nextActive=this.custom),this._isGoingBackward()?this._resetPosition(this.bounds.firstToLast):this._isGoingForward()&&this._resetPosition(this.bounds.lastToFirst),this.active=this.nextActive;const i=this._getDelayFromSpins(1);return this._changeTransition(i),this._animationFX=h.STOP,this._changeTransform(this.getTileOffset(this.active)),n((()=>{this.stopping=!1,this.running=!1,this.nextActive=void 0,"function"==typeof this.onComplete&&this.onComplete(this.active),"function"==typeof t&&t.apply(this,[this.active])}),i),this.active}run(){this.running||(this._timer=new r((()=>{this.visible||!0!==this.inViewport?this.shuffle(this.spins,(()=>{this._timer.reset()})):n((()=>{this._timer.reset()}),500)}),this.delay))}destroy(){this._fakeFirstTile.remove(),this._fakeLastTile.remove(),this.tiles.forEach((t=>{this.element.appendChild(t)})),this.container.remove()}}})(),s=s.default})())); +!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define("SlotMachine",[],i):"object"==typeof exports?exports.SlotMachine=i():t.SlotMachine=i()}(self,(()=>(()=>{var t={75:function(t){(function(){var i,e,s,n,r,o;"undefined"!=typeof performance&&null!==performance&&performance.now?t.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(t.exports=function(){return(i()-r)/1e6},e=process.hrtime,n=(i=function(){var t;return 1e9*(t=e())[0]+t[1]})(),o=1e9*process.uptime(),r=n-o):Date.now?(t.exports=function(){return Date.now()-s},s=Date.now()):(t.exports=function(){return(new Date).getTime()-s},s=(new Date).getTime())}).call(this)},87:(t,i,e)=>{for(var s=e(75),n="undefined"==typeof window?e.g:window,r=["moz","webkit"],o="AnimationFrame",h=n["request"+o],a=n["cancel"+o]||n["cancelRequest"+o],l=0;!h&&l{var i=t&&t.__esModule?()=>t.default:()=>t;return e.d(i,{a:i}),i},e.d=(t,i)=>{for(var s in i)e.o(i,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:i[s]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),e.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i);var s={};return(()=>{"use strict";e.d(s,{default:()=>a});var t=e(87),i=e.n(t);function n(t,e=0){setTimeout((()=>i()(t)),e)}class r{constructor(t,i){return this.cb=t,this.initialDelay=i,this.delay=i,this.running=!1,this.resume(),this}_start(){this.timer=setTimeout((()=>{this.running=!1,this.cb(this)}),this.delay)}cancel(){this.running=!1,clearTimeout(this.timer)}pause(){this.running&&(this.delay-=(new Date).getTime()-this.startTime,this.cancel())}resume(){this.running||(this.running=!0,this.startTime=(new Date).getTime(),this._start())}reset(){this.cancel(),this.delay=this.initialDelay,this._start()}add(t){this.pause(),this.delay+=t,this.resume()}}const o={active:0,delay:200,auto:!1,spins:5,randomize:void 0,onComplete:void 0,inViewport:!0,direction:"up",transition:"ease-in-out"};var h;!function(t){t.NO_TRANSITION="slotMachineNoTransition",t.FAST="slotMachineBlurFast",t.NORMAL="slotMachineBlurMedium",t.SLOW="slotMachineBlurSlow",t.TURTLE="slotMachineBlurTurtle",t.GRADIENT="slotMachineGradient",t.STOP="slotMachineGradient"}(h||(h={}));const a=class{constructor(t,i){this.element=t,this.tiles=[].slice.call(this.element.children),this.running=!1,this.stopping=!1,this.element.style.overflow="hidden",this._wrapTiles(),this._minTop=-this._fakeFirstTile.offsetHeight,this._maxTop=-this.tiles.reduce(((t,i)=>t+i.offsetHeight),0),this.changeSettings({...o,...i}),this._setBounds(),this._resetPosition(),this.auto&&this.run()}changeSettings(t){Object.keys(t).forEach((i=>{this[i]=t[i]}))}_wrapTiles(){this.container=document.createElement("div"),this.container.classList.add("slotMachineContainer"),this.container.style.transition="1s ease-in-out",this.element.appendChild(this.container),this._fakeFirstTile=this.tiles[this.tiles.length-1].cloneNode(!0),this.container.appendChild(this._fakeFirstTile),this.tiles.forEach((t=>{this.container.appendChild(t)})),this._fakeLastTile=this.tiles[0].cloneNode(!0),this.container.appendChild(this._fakeLastTile)}_setBounds(){const t=this.getTileOffset(this.active),i=this.getTileOffset(this.tiles.length),e=this.getTileOffset(this.tiles.length);this._bounds={up:{key:"up",initial:t,first:0,last:e,to:this._maxTop,firstToLast:e,lastToFirst:0},down:{key:"down",initial:t,first:i,last:0,to:this._minTop,firstToLast:e,lastToFirst:0}}}get active(){return this._active}set active(t){(t<0||t>=this.tiles.length||isNaN(t))&&(t=0),this._active=t}get direction(){return this._direction}set direction(t){this.running||(this._direction="down"===t?"down":"up")}get bounds(){return this._bounds[this._direction]}get transition(){return this._transition}set transition(t){this._transition=t||"ease-in-out"}get visibleTile(){const t=this.tiles[0].offsetHeight,i=this.container.style.transform||"",e=parseInt(i.replace(/^matrix\(-?\d+,\s?-?\d+,\s?-?\d+,\s?-?\d+,\s?-?\d+,\s?(-?\d+)\)$/,"$1"),10);return Math.abs(Math.round(e/t))-1}get random(){return Math.floor(Math.random()*this.tiles.length)}get custom(){let t=this.random;if(this.randomize){let i=this.randomize(this.active);(i<0||i>=this.tiles.length)&&(i=0),t=i}return t}get _prevIndex(){const t=this.active-1;return t<0?this.tiles.length-1:t}get _nextIndex(){const t=this.active+1;return t=0,n=t.left<=e&&t.left+t.width>=0;return s&&n}set _animationFX(t){n((()=>{[...this.tiles,this._fakeLastTile,this._fakeFirstTile].forEach((i=>{i.classList.remove(h.FAST,h.NORMAL,h.SLOW,h.TURTLE),t!==h.STOP&&i.classList.add(t)})),t===h.STOP?this.container.classList.remove(h.GRADIENT):this.container.classList.add(h.GRADIENT)}),this.delay/4)}_changeTransition(t=this.delay,i=this.transition){this.container.style.transition=`${t/1e3}s ${i}`}_changeTransform(t){this.container.style.transform=`matrix(1, 0, 0, 1, 0, ${t})`}_isGoingBackward(){return!(0!==this.active||this.nextActive!==this.tiles.length-1)}_isGoingForward(){return!(this.active!==this.tiles.length-1||0!==this.nextActive)}getTileOffset(t){let i=0;for(let e=0;e{if(!this.stopping&&this.running){const e=t-1;this._resetPosition(this.bounds.first),e>1?this.shuffle(e,i):this.stop(i)}}),e)}else this.stop(i);return this.nextActive}stop(t){if(!this.running||this.stopping)return this.nextActive;this.running=!0,this.stopping=!0,Number.isInteger(this.nextActive)||(this.nextActive=this.custom),this._isGoingBackward()?this._resetPosition(this.bounds.firstToLast):this._isGoingForward()&&this._resetPosition(this.bounds.lastToFirst),this.active=this.nextActive;const i=this._getDelayFromSpins(1);return this._changeTransition(i),this._animationFX=h.STOP,this._changeTransform(this.getTileOffset(this.active)),n((()=>{this.stopping=!1,this.running=!1,this.nextActive=void 0,"function"==typeof this.onComplete&&this.onComplete(this.active),"function"==typeof t&&t.apply(this,[this.active])}),i),this.active}run(){this.running||(this._timer=new r((()=>{this.visible||!0!==this.inViewport?this.shuffle(this.spins,(()=>{this._timer.reset()})):n((()=>{this._timer.reset()}),500)}),this.delay))}destroy(){this._fakeFirstTile.remove(),this._fakeLastTile.remove(),this.tiles.forEach((t=>{this.element.appendChild(t)})),this.container.remove()}}})(),s=s.default})())); //# sourceMappingURL=slotmachine.min.js.map \ No newline at end of file diff --git a/dist/slotmachine.min.js.map b/dist/slotmachine.min.js.map index 08f4091..2ab8969 100644 --- a/dist/slotmachine.min.js.map +++ b/dist/slotmachine.min.js.map @@ -1 +1 @@ -{"version":3,"file":"slotmachine.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB,CATD,CASGK,MAAM,I,6BCRT,WACE,IAAIC,EAAgBC,EAAQC,EAAUC,EAAgBC,EAAcC,EAExC,oBAAhBC,aAA+C,OAAhBA,aAAyBA,YAAYC,IAC9EX,EAAOD,QAAU,WACf,OAAOW,YAAYC,KACrB,EAC6B,oBAAZC,SAAuC,OAAZA,SAAqBA,QAAQP,QACzEL,EAAOD,QAAU,WACf,OAAQK,IAAmBI,GAAgB,GAC7C,EACAH,EAASO,QAAQP,OAMjBE,GALAH,EAAiB,WACf,IAAIS,EAEJ,OAAe,KADfA,EAAKR,KACK,GAAWQ,EAAG,EAC1B,KAEAJ,EAA4B,IAAnBG,QAAQE,SACjBN,EAAeD,EAAiBE,GACvBM,KAAKJ,KACdX,EAAOD,QAAU,WACf,OAAOgB,KAAKJ,MAAQL,CACtB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ACpBhK,KAAK8G,cAAckD,SAInBhK,KAAKqF,MAAMkB,SAASN,IAClBjG,KAAKmF,QAAQyB,YAAYX,EAAK,IAGhCjG,KAAKwG,UAAUwD,QACjB,E","sources":["webpack://SlotMachine/webpack/universalModuleDefinition","webpack://SlotMachine/./node_modules/performance-now/lib/performance-now.js","webpack://SlotMachine/./node_modules/raf/index.js","webpack://SlotMachine/webpack/bootstrap","webpack://SlotMachine/webpack/runtime/compat get default export","webpack://SlotMachine/webpack/runtime/define property getters","webpack://SlotMachine/webpack/runtime/global","webpack://SlotMachine/webpack/runtime/hasOwnProperty shorthand","webpack://SlotMachine/./lib/raf.ts","webpack://SlotMachine/./lib/timer.ts","webpack://SlotMachine/./lib/slot-machine.ts","webpack://SlotMachine/./lib/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SlotMachine\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SlotMachine\"] = factory();\n\telse\n\t\troot[\"SlotMachine\"] = factory();\n})(self, () => {\nreturn ","// Generated by CoffeeScript 1.12.2\n(function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n\n if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return new Date().getTime() - loadTime;\n };\n loadTime = new Date().getTime();\n }\n\n}).call(this);\n\n//# sourceMappingURL=performance-now.js.map\n","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import requestAnimationFrame from 'raf';\nimport { Callback } from './types';\n\nexport default function raf(cb: Callback, timeout = 0) {\n setTimeout(() => requestAnimationFrame(cb), timeout);\n}\n","import { Callback } from './types';\n\nexport default class Timer {\n cb: Callback;\n initialDelay: number;\n delay: number;\n startTime: number;\n timer: NodeJS.Timeout;\n running: boolean;\n\n constructor(cb: Callback, delay: number) {\n this.cb = cb;\n this.initialDelay = delay;\n this.delay = delay;\n this.running = false;\n\n this.resume();\n\n return this;\n }\n\n _start() {\n this.timer = setTimeout(() => {\n this.running = false;\n this.cb(this);\n }, this.delay);\n }\n\n cancel() {\n this.running = false;\n clearTimeout(this.timer);\n }\n\n pause() {\n if (this.running) {\n this.delay -= new Date().getTime() - this.startTime;\n this.cancel();\n }\n }\n\n resume() {\n if (!this.running) {\n this.running = true;\n this.startTime = new Date().getTime();\n\n this._start();\n }\n }\n\n reset() {\n this.cancel();\n this.delay = this.initialDelay;\n this._start();\n }\n\n add(extraDelay: number) {\n this.pause();\n this.delay += extraDelay;\n this.resume();\n }\n}\n","import raf from './raf';\nimport Timer from './timer';\n\nexport type RandomizeCallback = (active: number) => number;\nexport type OnCompleteCallback = (active: number) => any;\n\nexport type Direction = 'up' | 'down';\n\nexport type Bound = {\n key: Direction;\n initial: number;\n first: number;\n last: number;\n to: number;\n firstToLast: number;\n lastToFirst: number;\n};\n\nexport type Bounds = Record;\n\nexport type Options = {\n active: number;\n delay: number;\n auto: boolean;\n spins: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport: boolean;\n direction: Direction;\n transition: string;\n};\n\nconst defaults: Options = {\n active: 0, // Active element [Number]\n delay: 200, // Animation time [Number]\n auto: false, // Repeat delay [false||Number]\n spins: 5, // Number of spins when auto [Number]\n randomize: undefined, // Randomize function, must return a number with the selected position\n onComplete: undefined, // Callback function(result)\n inViewport: true, // Stops animations if the element isn´t visible on the screen\n direction: 'up', // Animation direction ['up'||'down']\n transition: 'ease-in-out',\n};\n\nexport enum FX {\n NO_TRANSITION = 'slotMachineNoTransition',\n FAST = 'slotMachineBlurFast',\n NORMAL = 'slotMachineBlurMedium',\n SLOW = 'slotMachineBlurSlow',\n TURTLE = 'slotMachineBlurTurtle',\n GRADIENT = 'slotMachineGradient',\n STOP = 'slotMachineGradient',\n}\n\nexport default class SlotMachine implements Options {\n container: HTMLElement;\n element: HTMLElement;\n tiles: HTMLElement[];\n running: boolean;\n stopping: boolean;\n nextActive?: number;\n\n // options\n delay: number;\n auto: boolean;\n spins: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport: boolean;\n\n private _active: number;\n private _minTop: number;\n private _maxTop: number;\n private _fakeFirstTile: HTMLElement;\n private _fakeLastTile: HTMLElement;\n private _bounds: Bounds;\n private _direction: Direction;\n private _transition: string;\n private _timer: Timer;\n\n constructor(element: HTMLElement, options: Options) {\n this.element = element;\n // Slot Machine elements\n this.tiles = [].slice.call(this.element.children) as HTMLElement[];\n // Machine is running?\n this.running = false;\n // Machine is stopping?\n this.stopping = false;\n // Disable overflow\n this.element.style.overflow = 'hidden';\n // Wrap elements inside container\n this._wrapTiles();\n // Set min top offset\n this._minTop = -this._fakeFirstTile.offsetHeight;\n // Set max top offset\n this._maxTop = -this.tiles.reduce((acc, tile) => acc + tile.offsetHeight, 0);\n // Call setters if neccesary\n this.changeSettings({ ...defaults, ...options });\n // Initialize spin direction [up, down]\n this._setBounds();\n // Show active element\n this._resetPosition();\n // Start auto animation\n if (this.auto !== false) {\n this.run();\n }\n }\n\n changeSettings(options: Options) {\n Object.keys(options).forEach((key) => {\n // Trigger setters\n this[key] = options[key];\n });\n }\n\n _wrapTiles() {\n this.container = document.createElement('div');\n this.container.classList.add('slotMachineContainer');\n this.container.style.transition = '1s ease-in-out';\n this.element.appendChild(this.container);\n\n this._fakeFirstTile = this.tiles[this.tiles.length - 1].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeFirstTile);\n\n this.tiles.forEach((tile) => {\n this.container.appendChild(tile);\n });\n\n this._fakeLastTile = this.tiles[0].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeLastTile);\n }\n\n _setBounds() {\n const initial = this.getTileOffset(this.active);\n const first = this.getTileOffset(this.tiles.length);\n const last = this.getTileOffset(this.tiles.length);\n\n this._bounds = {\n up: {\n key: 'up',\n initial,\n first: 0,\n last,\n to: this._maxTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n down: {\n key: 'down',\n initial,\n first,\n last: 0,\n to: this._minTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n };\n }\n\n get active() {\n return this._active;\n }\n\n set active(index: number) {\n if (index < 0 || index >= this.tiles.length || isNaN(index)) {\n index = 0;\n }\n\n this._active = index;\n }\n\n get direction() {\n return this._direction;\n }\n\n set direction(direction: Direction) {\n if (this.running) {\n return;\n }\n\n this._direction = direction === 'down' ? 'down' : 'up';\n }\n\n get bounds() {\n return this._bounds[this._direction];\n }\n\n get transition() {\n return this._transition;\n }\n\n set transition(transition: string) {\n this._transition = transition || 'ease-in-out';\n }\n\n get visibleTile() {\n const firstTileHeight = this.tiles[0].offsetHeight;\n const rawContainerMargin = this.container.style.transform || '';\n const matrixRegExp = /^matrix\\(-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?(-?\\d+)\\)$/;\n const containerMargin = parseInt(rawContainerMargin.replace(matrixRegExp, '$1'), 10);\n\n return Math.abs(Math.round(containerMargin / firstTileHeight)) - 1;\n }\n\n get random() {\n return Math.floor(Math.random() * this.tiles.length);\n }\n\n get custom() {\n let choosen = this.random;\n\n if (this.randomize) {\n let index = this.randomize(this.active);\n if (index < 0 || index >= this.tiles.length) {\n index = 0;\n }\n choosen = index;\n }\n\n return choosen;\n }\n\n get _prevIndex() {\n const prevIndex = this.active - 1;\n\n return prevIndex < 0 ? this.tiles.length - 1 : prevIndex;\n }\n\n get _nextIndex() {\n const nextIndex = this.active + 1;\n\n return nextIndex < this.tiles.length ? nextIndex : 0;\n }\n\n get prevIndex() {\n return this.direction === 'up' ? this._nextIndex : this._prevIndex;\n }\n\n get nextIndex() {\n return this.direction === 'up' ? this._prevIndex : this._nextIndex;\n }\n\n get visible() {\n const rect = this.element.getBoundingClientRect();\n const windowHeight = window.innerHeight || document.documentElement.clientHeight;\n const windowWidth = window.innerWidth || document.documentElement.clientWidth;\n const vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;\n const horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;\n\n return vertInView && horInView;\n }\n\n set _animationFX(effect: FX) {\n const delay = this.delay / 4;\n\n raf(() => {\n [...this.tiles, this._fakeLastTile, this._fakeFirstTile].forEach((tile) => {\n tile.classList.remove(FX.FAST, FX.NORMAL, FX.SLOW, FX.TURTLE);\n if (effect !== FX.STOP) {\n tile.classList.add(effect);\n }\n });\n\n if (effect === FX.STOP) {\n this.container.classList.remove(FX.GRADIENT);\n } else {\n this.container.classList.add(FX.GRADIENT);\n }\n }, delay);\n }\n\n _changeTransition(delay = this.delay, transition = this.transition) {\n this.container.style.transition = `${delay / 1000}s ${transition}`;\n }\n\n _changeTransform(margin: number) {\n this.container.style.transform = `matrix(1, 0, 0, 1, 0, ${margin})`;\n }\n\n _isGoingBackward() {\n return !!(\n this.active === 0 &&\n this.nextActive === this.tiles.length - 1\n );\n }\n\n _isGoingForward() {\n return !!(\n this.active === this.tiles.length - 1 &&\n this.nextActive === 0\n );\n }\n\n getTileOffset(index: number) {\n let offset = 0;\n\n for (let i = 0; i < index; i++) {\n offset += this.tiles[i].offsetHeight;\n }\n\n return this._minTop - offset;\n }\n\n _resetPosition(margin?: number) {\n this.container.classList.toggle(FX.NO_TRANSITION);\n this._changeTransform(margin !== undefined ? margin : this.bounds.initial);\n // Force reflow, flushing the CSS changes\n this.container.offsetHeight;\n this.container.classList.toggle(FX.NO_TRANSITION);\n }\n\n next() {\n this.direction = 'down';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n prev() {\n this.direction = 'up';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n _getDelayFromSpins(spins: number) {\n let delay = this.delay;\n this.transition = 'linear';\n\n switch (spins) {\n case 1:\n delay /= 0.5;\n this.transition = 'ease-out';\n this._animationFX = FX.TURTLE;\n break;\n case 2:\n delay /= 0.75;\n this._animationFX = FX.SLOW;\n break;\n case 3:\n delay /= 1;\n this._animationFX = FX.NORMAL;\n break;\n case 4:\n delay /= 1.25;\n this._animationFX = FX.NORMAL;\n break;\n default:\n delay /= 1.5;\n this._animationFX = FX.FAST;\n }\n\n return delay;\n }\n\n shuffle(spins: number, onComplete: OnCompleteCallback) {\n // Make spins optional\n if (typeof spins === 'function') {\n onComplete = spins;\n }\n this.running = true;\n // Perform animation\n if (!this.visible && this.inViewport === true) {\n this.stop(onComplete);\n } else {\n const delay = this._getDelayFromSpins(spins);\n // this.delay = delay;\n this._changeTransition(delay);\n this._changeTransform(this.bounds.to);\n raf(() => {\n if (!this.stopping && this.running) {\n const left = spins - 1;\n\n this._resetPosition(this.bounds.first);\n\n if (left > 1) {\n // Repeat animation\n this.shuffle(left, onComplete);\n } else {\n this.stop(onComplete);\n }\n }\n }, delay);\n }\n\n return this.nextActive;\n }\n\n stop(onStop?: OnCompleteCallback) {\n if (!this.running || this.stopping) {\n return this.nextActive;\n }\n\n this.running = true;\n this.stopping = true;\n\n if (!Number.isInteger(this.nextActive)) {\n // Get random or custom element\n this.nextActive = this.custom;\n }\n\n // Check direction to prevent jumping\n if (this._isGoingBackward()) {\n this._resetPosition(this.bounds.firstToLast);\n } else if (this._isGoingForward()) {\n this._resetPosition(this.bounds.lastToFirst);\n }\n\n // Update last choosen element index\n this.active = this.nextActive as number;\n\n // Perform animation\n const delay = this._getDelayFromSpins(1);\n // this.delay = delay;\n this._changeTransition(delay);\n this._animationFX = FX.STOP;\n this._changeTransform(this.getTileOffset(this.active));\n raf(() => {\n this.stopping = false;\n this.running = false;\n this.nextActive = undefined;\n\n if (typeof this.onComplete === 'function') {\n this.onComplete(this.active);\n }\n\n if (typeof onStop === 'function') {\n onStop.apply(this, [this.active]);\n }\n }, delay);\n\n return this.active;\n }\n\n run() {\n if (this.running) {\n return;\n }\n\n this._timer = new Timer(() => {\n if (!this.visible && this.inViewport === true) {\n raf(() => {\n this._timer.reset();\n }, 500);\n } else {\n this.shuffle(this.spins, () => {\n this._timer.reset();\n });\n }\n }, this.delay);\n }\n\n destroy() {\n this._fakeFirstTile.remove();\n this._fakeLastTile.remove();\n // this.$tiles.unwrap();\n\n // Unwrap tiles\n this.tiles.forEach((tile) => {\n this.element.appendChild(tile);\n });\n\n this.container.remove();\n }\n}\n","import SlotMachine from './slot-machine';\n\nexport default SlotMachine;\n"],"names":["root","factory","exports","module","define","amd","self","getNanoSeconds","hrtime","loadTime","moduleLoadTime","nodeLoadTime","upTime","performance","now","process","hr","uptime","Date","getTime","call","this","window","g","vendors","suffix","raf","caf","i","length","last","id","queue","callback","_now","next","Math","max","setTimeout","cp","slice","cancelled","e","round","push","handle","fn","cancel","apply","arguments","polyfill","object","requestAnimationFrame","cancelAnimationFrame","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","globalThis","Function","obj","prop","prototype","hasOwnProperty","cb","timeout","Timer","constructor","delay","initialDelay","running","resume","_start","timer","clearTimeout","pause","startTime","reset","add","extraDelay","defaults","active","auto","spins","randomize","onComplete","inViewport","direction","transition","FX","element","options","tiles","children","stopping","style","overflow","_wrapTiles","_minTop","_fakeFirstTile","offsetHeight","_maxTop","reduce","acc","tile","changeSettings","_setBounds","_resetPosition","run","keys","forEach","container","document","createElement","classList","appendChild","cloneNode","_fakeLastTile","initial","getTileOffset","first","_bounds","up","to","firstToLast","lastToFirst","down","_active","index","isNaN","_direction","bounds","_transition","visibleTile","firstTileHeight","rawContainerMargin","transform","containerMargin","parseInt","replace","abs","random","floor","custom","choosen","_prevIndex","prevIndex","_nextIndex","nextIndex","visible","rect","getBoundingClientRect","windowHeight","innerHeight","documentElement","clientHeight","windowWidth","innerWidth","clientWidth","vertInView","top","height","horInView","left","width","_animationFX","effect","remove","FAST","NORMAL","SLOW","TURTLE","STOP","GRADIENT","_changeTransition","_changeTransform","margin","_isGoingBackward","nextActive","_isGoingForward","offset","toggle","NO_TRANSITION","stop","prev","_getDelayFromSpins","shuffle","onStop","Number","isInteger","_timer","destroy"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"slotmachine.min.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,IAEzBD,EAAkB,YAAIC,GACvB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1E,KAAKuF,UAAW,EAChBvF,KAAK+D,SAAU,EACf/D,KAAK2K,gBAAatI,EAEa,mBAApBrC,KAAK8E,YACd9E,KAAK8E,WAAW9E,KAAK0E,QAGD,mBAAX0G,GACTA,EAAOzJ,MAAM3B,KAAM,CAACA,KAAK0E,Q,GAE1Bb,GAEI7D,KAAK0E,MACd,CAEA2B,MACMrG,KAAK+D,UAIT/D,KAAKuL,OAAS,IAAI5H,GAAM,KACjB3D,KAAK8I,UAA+B,IAApB9I,KAAK+E,WAKxB/E,KAAKmL,QAAQnL,KAAK4E,OAAO,KACvB5E,KAAKuL,OAAOjH,OAAO,IALrB,GAAI,KACFtE,KAAKuL,OAAOjH,OAAO,GAClB,I,GAMJtE,KAAK6D,OACV,CAEA2H,UACExL,KAAK4F,eAAeoE,SACpBhK,KAAK8G,cAAckD,SAInBhK,KAAKqF,MAAMkB,SAASN,IAClBjG,KAAKmF,QAAQyB,YAAYX,EAAK,IAGhCjG,KAAKwG,UAAUwD,QACjB,E","sources":["webpack://SlotMachine/webpack/universalModuleDefinition","webpack://SlotMachine/./node_modules/performance-now/lib/performance-now.js","webpack://SlotMachine/./node_modules/raf/index.js","webpack://SlotMachine/webpack/bootstrap","webpack://SlotMachine/webpack/runtime/compat get default export","webpack://SlotMachine/webpack/runtime/define property getters","webpack://SlotMachine/webpack/runtime/global","webpack://SlotMachine/webpack/runtime/hasOwnProperty shorthand","webpack://SlotMachine/./lib/raf.ts","webpack://SlotMachine/./lib/timer.ts","webpack://SlotMachine/./lib/slot-machine.ts","webpack://SlotMachine/./lib/index.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"SlotMachine\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"SlotMachine\"] = factory();\n\telse\n\t\troot[\"SlotMachine\"] = factory();\n})(self, () => {\nreturn ","// Generated by CoffeeScript 1.12.2\n(function() {\n var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime;\n\n if ((typeof performance !== \"undefined\" && performance !== null) && performance.now) {\n module.exports = function() {\n return performance.now();\n };\n } else if ((typeof process !== \"undefined\" && process !== null) && process.hrtime) {\n module.exports = function() {\n return (getNanoSeconds() - nodeLoadTime) / 1e6;\n };\n hrtime = process.hrtime;\n getNanoSeconds = function() {\n var hr;\n hr = hrtime();\n return hr[0] * 1e9 + hr[1];\n };\n moduleLoadTime = getNanoSeconds();\n upTime = process.uptime() * 1e9;\n nodeLoadTime = moduleLoadTime - upTime;\n } else if (Date.now) {\n module.exports = function() {\n return Date.now() - loadTime;\n };\n loadTime = Date.now();\n } else {\n module.exports = function() {\n return new Date().getTime() - loadTime;\n };\n loadTime = new Date().getTime();\n }\n\n}).call(this);\n\n//# sourceMappingURL=performance-now.js.map\n","var now = require('performance-now')\n , root = typeof window === 'undefined' ? global : window\n , vendors = ['moz', 'webkit']\n , suffix = 'AnimationFrame'\n , raf = root['request' + suffix]\n , caf = root['cancel' + suffix] || root['cancelRequest' + suffix]\n\nfor(var i = 0; !raf && i < vendors.length; i++) {\n raf = root[vendors[i] + 'Request' + suffix]\n caf = root[vendors[i] + 'Cancel' + suffix]\n || root[vendors[i] + 'CancelRequest' + suffix]\n}\n\n// Some versions of FF have rAF but not cAF\nif(!raf || !caf) {\n var last = 0\n , id = 0\n , queue = []\n , frameDuration = 1000 / 60\n\n raf = function(callback) {\n if(queue.length === 0) {\n var _now = now()\n , next = Math.max(0, frameDuration - (_now - last))\n last = next + _now\n setTimeout(function() {\n var cp = queue.slice(0)\n // Clear queue here to prevent\n // callbacks from appending listeners\n // to the current frame's queue\n queue.length = 0\n for(var i = 0; i < cp.length; i++) {\n if(!cp[i].cancelled) {\n try{\n cp[i].callback(last)\n } catch(e) {\n setTimeout(function() { throw e }, 0)\n }\n }\n }\n }, Math.round(next))\n }\n queue.push({\n handle: ++id,\n callback: callback,\n cancelled: false\n })\n return id\n }\n\n caf = function(handle) {\n for(var i = 0; i < queue.length; i++) {\n if(queue[i].handle === handle) {\n queue[i].cancelled = true\n }\n }\n }\n}\n\nmodule.exports = function(fn) {\n // Wrap in a new function to prevent\n // `cancel` potentially being assigned\n // to the native rAF function\n return raf.call(root, fn)\n}\nmodule.exports.cancel = function() {\n caf.apply(root, arguments)\n}\nmodule.exports.polyfill = function(object) {\n if (!object) {\n object = root;\n }\n object.requestAnimationFrame = raf\n object.cancelAnimationFrame = caf\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import requestAnimationFrame from 'raf';\nimport { Callback } from './types';\n\nexport default function raf(cb: Callback, timeout = 0) {\n setTimeout(() => requestAnimationFrame(cb), timeout);\n}\n","import { Callback } from './types';\n\nexport default class Timer {\n cb: Callback;\n initialDelay: number;\n delay: number;\n startTime: number;\n timer: NodeJS.Timeout;\n running: boolean;\n\n constructor(cb: Callback, delay: number) {\n this.cb = cb;\n this.initialDelay = delay;\n this.delay = delay;\n this.running = false;\n\n this.resume();\n\n return this;\n }\n\n _start() {\n this.timer = setTimeout(() => {\n this.running = false;\n this.cb(this);\n }, this.delay);\n }\n\n cancel() {\n this.running = false;\n clearTimeout(this.timer);\n }\n\n pause() {\n if (this.running) {\n this.delay -= new Date().getTime() - this.startTime;\n this.cancel();\n }\n }\n\n resume() {\n if (!this.running) {\n this.running = true;\n this.startTime = new Date().getTime();\n\n this._start();\n }\n }\n\n reset() {\n this.cancel();\n this.delay = this.initialDelay;\n this._start();\n }\n\n add(extraDelay: number) {\n this.pause();\n this.delay += extraDelay;\n this.resume();\n }\n}\n","import raf from './raf';\nimport Timer from './timer';\n\nexport type RandomizeCallback = (active: number) => number;\nexport type OnCompleteCallback = (active: number) => any;\n\nexport type Direction = 'up' | 'down';\n\nexport type Bound = {\n key: Direction;\n initial: number;\n first: number;\n last: number;\n to: number;\n firstToLast: number;\n lastToFirst: number;\n};\n\nexport type Bounds = Record;\n\nexport type Options = {\n active?: number;\n delay?: number;\n auto?: boolean;\n spins?: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport?: boolean;\n direction?: Direction;\n transition?: string;\n};\n\nconst defaults: Options = {\n active: 0, // Active element [Number]\n delay: 200, // Animation time [Number]\n auto: false, // Repeat delay [false||Number]\n spins: 5, // Number of spins when auto [Number]\n randomize: undefined, // Randomize function, must return a number with the selected position\n onComplete: undefined, // Callback function(result)\n inViewport: true, // Stops animations if the element isn´t visible on the screen\n direction: 'up', // Animation direction ['up'||'down']\n transition: 'ease-in-out',\n};\n\nexport enum FX {\n NO_TRANSITION = 'slotMachineNoTransition',\n FAST = 'slotMachineBlurFast',\n NORMAL = 'slotMachineBlurMedium',\n SLOW = 'slotMachineBlurSlow',\n TURTLE = 'slotMachineBlurTurtle',\n GRADIENT = 'slotMachineGradient',\n STOP = 'slotMachineGradient',\n}\n\nexport default class SlotMachine implements Options {\n container: HTMLElement;\n element: HTMLElement;\n tiles: HTMLElement[];\n running: boolean;\n stopping: boolean;\n nextActive?: number;\n\n // options\n delay: number;\n auto: boolean;\n spins: number;\n randomize?: RandomizeCallback;\n onComplete?: OnCompleteCallback;\n inViewport: boolean;\n\n private _active: number;\n private _minTop: number;\n private _maxTop: number;\n private _fakeFirstTile: HTMLElement;\n private _fakeLastTile: HTMLElement;\n private _bounds: Bounds;\n private _direction: Direction;\n private _transition: string;\n private _timer: Timer;\n\n constructor(element: HTMLElement, options: Options) {\n this.element = element;\n // Slot Machine elements\n this.tiles = [].slice.call(this.element.children) as HTMLElement[];\n // Machine is running?\n this.running = false;\n // Machine is stopping?\n this.stopping = false;\n // Disable overflow\n this.element.style.overflow = 'hidden';\n // Wrap elements inside container\n this._wrapTiles();\n // Set min top offset\n this._minTop = -this._fakeFirstTile.offsetHeight;\n // Set max top offset\n this._maxTop = -this.tiles.reduce((acc, tile) => acc + tile.offsetHeight, 0);\n // Call setters if neccesary\n this.changeSettings({ ...defaults, ...options });\n // Initialize spin direction [up, down]\n this._setBounds();\n // Show active element\n this._resetPosition();\n // Start auto animation\n if (this.auto) {\n this.run();\n }\n }\n\n changeSettings(options: Options) {\n Object.keys(options).forEach((key) => {\n // Trigger setters\n this[key] = options[key]; /* @ts-ignore */\n });\n }\n\n _wrapTiles() {\n this.container = document.createElement('div');\n this.container.classList.add('slotMachineContainer');\n this.container.style.transition = '1s ease-in-out';\n this.element.appendChild(this.container);\n\n this._fakeFirstTile = this.tiles[this.tiles.length - 1].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeFirstTile);\n\n this.tiles.forEach((tile) => {\n this.container.appendChild(tile);\n });\n\n this._fakeLastTile = this.tiles[0].cloneNode(true) as HTMLElement;\n this.container.appendChild(this._fakeLastTile);\n }\n\n _setBounds() {\n const initial = this.getTileOffset(this.active);\n const first = this.getTileOffset(this.tiles.length);\n const last = this.getTileOffset(this.tiles.length);\n\n this._bounds = {\n up: {\n key: 'up',\n initial,\n first: 0,\n last,\n to: this._maxTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n down: {\n key: 'down',\n initial,\n first,\n last: 0,\n to: this._minTop,\n firstToLast: last,\n lastToFirst: 0,\n },\n };\n }\n\n get active() {\n return this._active;\n }\n\n set active(index: number) {\n if (index < 0 || index >= this.tiles.length || isNaN(index)) {\n index = 0;\n }\n\n this._active = index;\n }\n\n get direction() {\n return this._direction;\n }\n\n set direction(direction: Direction) {\n if (this.running) {\n return;\n }\n\n this._direction = direction === 'down' ? 'down' : 'up';\n }\n\n get bounds() {\n return this._bounds[this._direction];\n }\n\n get transition() {\n return this._transition;\n }\n\n set transition(transition: string) {\n this._transition = transition || 'ease-in-out';\n }\n\n get visibleTile() {\n const firstTileHeight = this.tiles[0].offsetHeight;\n const rawContainerMargin = this.container.style.transform || '';\n const matrixRegExp = /^matrix\\(-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?-?\\d+,\\s?(-?\\d+)\\)$/;\n const containerMargin = parseInt(rawContainerMargin.replace(matrixRegExp, '$1'), 10);\n\n return Math.abs(Math.round(containerMargin / firstTileHeight)) - 1;\n }\n\n get random() {\n return Math.floor(Math.random() * this.tiles.length);\n }\n\n get custom() {\n let choosen = this.random;\n\n if (this.randomize) {\n let index = this.randomize(this.active);\n if (index < 0 || index >= this.tiles.length) {\n index = 0;\n }\n choosen = index;\n }\n\n return choosen;\n }\n\n get _prevIndex() {\n const prevIndex = this.active - 1;\n\n return prevIndex < 0 ? this.tiles.length - 1 : prevIndex;\n }\n\n get _nextIndex() {\n const nextIndex = this.active + 1;\n\n return nextIndex < this.tiles.length ? nextIndex : 0;\n }\n\n get prevIndex() {\n return this.direction === 'up' ? this._nextIndex : this._prevIndex;\n }\n\n get nextIndex() {\n return this.direction === 'up' ? this._prevIndex : this._nextIndex;\n }\n\n get visible() {\n const rect = this.element.getBoundingClientRect();\n const windowHeight = window.innerHeight || document.documentElement.clientHeight;\n const windowWidth = window.innerWidth || document.documentElement.clientWidth;\n const vertInView = rect.top <= windowHeight && rect.top + rect.height >= 0;\n const horInView = rect.left <= windowWidth && rect.left + rect.width >= 0;\n\n return vertInView && horInView;\n }\n\n set _animationFX(effect: FX) {\n const delay = this.delay / 4;\n\n raf(() => {\n [...this.tiles, this._fakeLastTile, this._fakeFirstTile].forEach((tile) => {\n tile.classList.remove(FX.FAST, FX.NORMAL, FX.SLOW, FX.TURTLE);\n if (effect !== FX.STOP) {\n tile.classList.add(effect);\n }\n });\n\n if (effect === FX.STOP) {\n this.container.classList.remove(FX.GRADIENT);\n } else {\n this.container.classList.add(FX.GRADIENT);\n }\n }, delay);\n }\n\n _changeTransition(delay = this.delay, transition = this.transition) {\n this.container.style.transition = `${delay / 1000}s ${transition}`;\n }\n\n _changeTransform(margin: number) {\n this.container.style.transform = `matrix(1, 0, 0, 1, 0, ${margin})`;\n }\n\n _isGoingBackward() {\n return !!(\n this.active === 0 &&\n this.nextActive === this.tiles.length - 1\n );\n }\n\n _isGoingForward() {\n return !!(\n this.active === this.tiles.length - 1 &&\n this.nextActive === 0\n );\n }\n\n getTileOffset(index: number) {\n let offset = 0;\n\n for (let i = 0; i < index; i++) {\n offset += this.tiles[i].offsetHeight;\n }\n\n return this._minTop - offset;\n }\n\n _resetPosition(margin?: number) {\n this.container.classList.toggle(FX.NO_TRANSITION);\n this._changeTransform(margin !== undefined ? margin : this.bounds.initial);\n // Force reflow, flushing the CSS changes\n this.container.offsetHeight;\n this.container.classList.toggle(FX.NO_TRANSITION);\n }\n\n next() {\n this.direction = 'down';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n prev() {\n this.direction = 'up';\n this.nextActive = this.nextIndex;\n this.running = true;\n this.stop();\n\n return this.nextActive;\n }\n\n _getDelayFromSpins(spins: number) {\n let delay = this.delay;\n this.transition = 'linear';\n\n switch (spins) {\n case 1:\n delay /= 0.5;\n this.transition = 'ease-out';\n this._animationFX = FX.TURTLE;\n break;\n case 2:\n delay /= 0.75;\n this._animationFX = FX.SLOW;\n break;\n case 3:\n delay /= 1;\n this._animationFX = FX.NORMAL;\n break;\n case 4:\n delay /= 1.25;\n this._animationFX = FX.NORMAL;\n break;\n default:\n delay /= 1.5;\n this._animationFX = FX.FAST;\n }\n\n return delay;\n }\n\n shuffle(spins: number, onComplete: OnCompleteCallback) {\n // Make spins optional\n if (typeof spins === 'function') {\n onComplete = spins;\n }\n this.running = true;\n // Perform animation\n if (!this.visible && this.inViewport === true) {\n this.stop(onComplete);\n } else {\n const delay = this._getDelayFromSpins(spins);\n // this.delay = delay;\n this._changeTransition(delay);\n this._changeTransform(this.bounds.to);\n raf(() => {\n if (!this.stopping && this.running) {\n const left = spins - 1;\n\n this._resetPosition(this.bounds.first);\n\n if (left > 1) {\n // Repeat animation\n this.shuffle(left, onComplete);\n } else {\n this.stop(onComplete);\n }\n }\n }, delay);\n }\n\n return this.nextActive;\n }\n\n stop(onStop?: OnCompleteCallback) {\n if (!this.running || this.stopping) {\n return this.nextActive;\n }\n\n this.running = true;\n this.stopping = true;\n\n if (!Number.isInteger(this.nextActive)) {\n // Get random or custom element\n this.nextActive = this.custom;\n }\n\n // Check direction to prevent jumping\n if (this._isGoingBackward()) {\n this._resetPosition(this.bounds.firstToLast);\n } else if (this._isGoingForward()) {\n this._resetPosition(this.bounds.lastToFirst);\n }\n\n // Update last choosen element index\n this.active = this.nextActive as number;\n\n // Perform animation\n const delay = this._getDelayFromSpins(1);\n // this.delay = delay;\n this._changeTransition(delay);\n this._animationFX = FX.STOP;\n this._changeTransform(this.getTileOffset(this.active));\n raf(() => {\n this.stopping = false;\n this.running = false;\n this.nextActive = undefined;\n\n if (typeof this.onComplete === 'function') {\n this.onComplete(this.active);\n }\n\n if (typeof onStop === 'function') {\n onStop.apply(this, [this.active]);\n }\n }, delay);\n\n return this.active;\n }\n\n run() {\n if (this.running) {\n return;\n }\n\n this._timer = new Timer(() => {\n if (!this.visible && this.inViewport === true) {\n raf(() => {\n this._timer.reset();\n }, 500);\n } else {\n this.shuffle(this.spins, () => {\n this._timer.reset();\n });\n }\n }, this.delay);\n }\n\n destroy() {\n this._fakeFirstTile.remove();\n this._fakeLastTile.remove();\n // this.$tiles.unwrap();\n\n // Unwrap tiles\n this.tiles.forEach((tile) => {\n this.element.appendChild(tile);\n });\n\n this.container.remove();\n }\n}\n","import SlotMachine from './slot-machine';\n\nexport default SlotMachine;\n"],"names":["root","factory","exports","module","define","amd","self","getNanoSeconds","hrtime","loadTime","moduleLoadTime","nodeLoadTime","upTime","performance","now","process","hr","uptime","Date","getTime","call","this","window","g","vendors","suffix","raf","caf","i","length","last","id","queue","callback","_now","next","Math","max","setTimeout","cp","slice","cancelled","e","round","push","handle","fn","cancel","apply","arguments","polyfill","object","requestAnimationFrame","cancelAnimationFrame","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","globalThis","Function","obj","prop","prototype","hasOwnProperty","cb","timeout","Timer","constructor","delay","initialDelay","running","resume","_start","timer","clearTimeout","pause","startTime","reset","add","extraDelay","defaults","active","auto","spins","randomize","onComplete","inViewport","direction","transition","FX","element","options","tiles","children","stopping","style","overflow","_wrapTiles","_minTop","_fakeFirstTile","offsetHeight","_maxTop","reduce","acc","tile","changeSettings","_setBounds","_resetPosition","run","keys","forEach","container","document","createElement","classList","appendChild","cloneNode","_fakeLastTile","initial","getTileOffset","first","_bounds","up","to","firstToLast","lastToFirst","down","_active","index","isNaN","_direction","bounds","_transition","visibleTile","firstTileHeight","rawContainerMargin","transform","containerMargin","parseInt","replace","abs","random","floor","custom","choosen","_prevIndex","prevIndex","_nextIndex","nextIndex","visible","rect","getBoundingClientRect","windowHeight","innerHeight","documentElement","clientHeight","windowWidth","innerWidth","clientWidth","vertInView","top","height","horInView","left","width","_animationFX","effect","remove","FAST","NORMAL","SLOW","TURTLE","STOP","GRADIENT","_changeTransition","_changeTransform","margin","_isGoingBackward","nextActive","_isGoingForward","offset","toggle","NO_TRANSITION","stop","prev","_getDelayFromSpins","shuffle","onStop","Number","isInteger","_timer","destroy"],"sourceRoot":""} \ No newline at end of file