{"version":3,"sources":["tilt.jquery.js"],"names":["$","fn","tilt","options","requestTick","ticking","requestAnimationFrame","updateTransforms","bind","bindEvents","_this","on","mouseMove","mouseEnter","settings","reset","mouseLeave","glare","window","updateGlareSize","setTransition","timeout","undefined","clearTimeout","css","speed","easing","glareElement","setTimeout","event","call","trigger","getMousePositions","pageX","offset","left","outerWidth","pageY","top","outerHeight","x","y","mousePositions","getValues","width","height","percentageX","percentageY","tiltX","maxTilt","toFixed","tiltY","angle","Math","atan2","PI","transforms","perspective","axis","scale","maxGlare","prepareGlare","glarePrerender","append","glareElementWrapper","find","stretch","destroy","each","remove","off","results","push","data","transition","extend","is","init","jQuery"],"mappings":";;AAAC,WAAUA,CAAV,EAAa;AACVA,MAAEC,EAAF,CAAKC,IAAL,GAAY,UAAUC,OAAV,EAAmB;;AAE3B;;;AAGA,YAAMC,cAAc,SAAdA,WAAc,GAAW;AAC3B,gBAAI,KAAKC,OAAT,EAAkB;AAClBC,kCAAsBC,iBAAiBC,IAAjB,CAAsB,IAAtB,CAAtB;AACA,iBAAKH,OAAL,GAAe,IAAf;AACH,SAJD;;AAMA;;;AAGA,YAAMI,aAAa,SAAbA,UAAa,GAAW;AAC1B,gBAAMC,QAAQ,IAAd;AACAV,cAAE,IAAF,EAAQW,EAAR,CAAW,WAAX,EAAwBC,SAAxB;AACAZ,cAAE,IAAF,EAAQW,EAAR,CAAW,YAAX,EAAyBE,UAAzB;AACA,gBAAI,KAAKC,QAAL,CAAcC,KAAlB,EAAyBf,EAAE,IAAF,EAAQW,EAAR,CAAW,YAAX,EAAyBK,UAAzB;AACzB,gBAAI,KAAKF,QAAL,CAAcG,KAAlB,EAAyBjB,EAAEkB,MAAF,EAAUP,EAAV,CAAa,QAAb,EAAuBQ,gBAAgBX,IAAhB,CAAqBE,KAArB,CAAvB;AAC5B,SAND;;AAQA;;;AAGA,YAAMU,gBAAgB,SAAhBA,aAAgB,GAAW;AAAA;;AAC7B,gBAAI,KAAKC,OAAL,KAAiBC,S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C,GAA6D,IAP9C;AAQrB1D,uBAAOf,EAAE,IAAF,EAAQ4E,EAAR,CAAW,mBAAX,IAAkC5E,EAAE,IAAF,EAAQyE,IAAR,CAAa,YAAb,CAAlC,GAA+D,IARjD;AASrBxD,uBAAOjB,EAAE,IAAF,EAAQ4E,EAAR,CAAW,mBAAX,IAAkC5E,EAAE,IAAF,EAAQyE,IAAR,CAAa,YAAb,CAAlC,GAA+D,KATjD;AAUrBb,0BAAU5D,EAAE,IAAF,EAAQ4E,EAAR,CAAW,sBAAX,IAAqC5E,EAAE,IAAF,EAAQyE,IAAR,CAAa,eAAb,CAArC,GAAqE;AAV1D,aAAT,EAWbtE,OAXa,CAAhB;;AAcA,iBAAK0E,IAAL,GAAY,YAAM;AACd;AACA7E,0BAAQyE,IAAR,CAAa,UAAb,EAAyB,OAAK3D,QAA9B;;AAEA;AACA,oBAAG,OAAKA,QAAL,CAAcG,KAAjB,EAAwB4C,aAAa/B,IAAb;;AAExB;AACArB,2BAAWqB,IAAX;AACH,aATD;;AAWA;AACA,iBAAK+C,IAAL;AAEH,SAnCM,CAAP;AAoCH,KAvQD;;AAyQA;;;AAGA7E,MAAE,aAAF,EAAiBE,IAAjB;AAEH,CA/QA,EA+QC4E,MA/QD,CAAD","file":"tilt.jquery.js","sourcesContent":["(function ($) {\r\n $.fn.tilt = function (options) {\r\n\r\n /**\r\n * RequestAnimationFrame\r\n */\r\n const requestTick = function() {\r\n if (this.ticking) return;\r\n requestAnimationFrame(updateTransforms.bind(this));\r\n this.ticking = true;\r\n };\r\n\r\n /**\r\n * Bind mouse movement evens on instance\r\n */\r\n const bindEvents = function() {\r\n const _this = this;\r\n $(this).on('mousemove', mouseMove);\r\n $(this).on('mouseenter', mouseEnter);\r\n if (this.settings.reset) $(this).on('mouseleave', mouseLeave);\r\n if (this.settings.glare) $(window).on('resize', updateGlareSize.bind(_this));\r\n };\r\n\r\n /**\r\n * Set transition only on mouse leave and mouse enter so it doesn't influence mouse move transforms\r\n */\r\n const setTransition = function() {\r\n if (this.timeout !== undefined) clearTimeout(this.timeout);\r\n $(this).css({'transition': `${this.settings.speed}ms ${this.settings.easing}`});\r\n if(this.settings.glare) this.glareElement.css({'transition': `opacity ${this.settings.speed}ms ${this.settings.easing}`});\r\n this.timeout = setTimeout(() => {\r\n $(this).css({'transition': ''});\r\n if(this.settings.glare) this.glareElement.css({'transition': ''});\r\n }, this.settings.speed);\r\n };\r\n\r\n /**\r\n * When user mouse enters tilt element\r\n */\r\n const mouseEnter = function(event) {\r\n this.ticking = false;\r\n $(this).css({'will-change': 'transform'});\r\n setTransition.call(this);\r\n\r\n // Trigger change event\r\n $(this).trigger(\"tilt.mouseEnter\");\r\n };\r\n\r\n /**\r\n * Return the x,y position of the mouse on the tilt element\r\n * @returns {{x: *, y: *}}\r\n */\r\n const getMousePositions = function(event) {\r\n if (typeof(event) === \"undefined\") {\r\n event = {\r\n pageX: $(this).offset().left + $(this).outerWidth() / 2,\r\n pageY: $(this).offset().top + $(this).outerHeight() / 2\r\n };\r\n }\r\n return {x: event.pageX, y: event.pageY};\r\n };\r\n\r\n /**\r\n * When user mouse moves over the tilt element\r\n */\r\n const mouseMove = function(event) {\r\n this.mousePositions = getMousePositions(event);\r\n requestTick.call(this);\r\n };\r\n\r\n /**\r\n * When user mouse leaves tilt element\r\n */\r\n const mouseLeave = function() {\r\n setTransition.call(this);\r\n this.reset = true;\r\n requestTick.call(this);\r\n\r\n // Trigger change event\r\n $(this).trigger(\"tilt.mouseLeave\");\r\n };\r\n\r\n /**\r\n * Get tilt values\r\n *\r\n * @returns {{x: tilt value, y: tilt value}}\r\n */\r\n const getValues = function() {\r\n const width = $(this).outerWidth();\r\n const height = $(this).outerHeight();\r\n const left = $(this).offset().left;\r\n const top = $(this).offset().top;\r\n const percentageX = (this.mousePositions.x - left) / width;\r\n const percentageY = (this.mousePositions.y - top) / height;\r\n // x or y position inside instance / width of instance = percentage of position inside instance * the max tilt value\r\n const tiltX = ((this.settings.maxTilt / 2) - ((percentageX) * this.settings.maxTilt)).toFixed(2);\r\n const tiltY = (((percentageY) * this.settings.maxTilt) - (this.settings.maxTilt / 2)).toFixed(2);\r\n // angle\r\n const angle = Math.atan2(this.mousePositions.x - (left+width/2),- (this.mousePositions.y - (top+height/2)) )*(180/Math.PI);\r\n // Return x & y tilt values\r\n return {tiltX, tiltY, 'percentageX': percentageX * 100, 'percentageY': percentageY * 100, angle};\r\n };\r\n\r\n /**\r\n * Update tilt transforms on mousemove\r\n */\r\n const updateTransforms = function() {\r\n this.transforms = getValues.call(this);\r\n\r\n if (this.reset) {\r\n this.reset = false;\r\n $(this).css('transform', `perspective(${this.settings.perspective}px) rotateX(0deg) rotateY(0deg)`);\r\n\r\n // Rotate glare if enabled\r\n if (this.settings.glare){\r\n this.glareElement.css('transform', `rotate(180deg) translate(-50%, -50%)`);\r\n this.glareElement.css('opacity', `0`);\r\n }\r\n\r\n return;\r\n } else {\r\n $(this).css('transform', `perspective(${this.settings.perspective}px) rotateX(${this.settings.axis === 'x' ? 0 : this.transforms.tiltY}deg) rotateY(${this.settings.axis === 'y' ? 0 : this.transforms.tiltX}deg) scale3d(${this.settings.scale},${this.settings.scale},${this.settings.scale})`);\r\n\r\n // Rotate glare if enabled\r\n if (this.settings.glare){\r\n this.glareElement.css('transform', `rotate(${this.transforms.angle}deg) translate(-50%, -50%)`);\r\n this.glareElement.css('opacity', `${this.transforms.percentageY * this.settings.maxGlare / 100}`);\r\n }\r\n }\r\n\r\n // Trigger change event\r\n $(this).trigger(\"change\", [this.transforms]);\r\n\r\n this.ticking = false;\r\n };\r\n\r\n /**\r\n * Prepare elements\r\n */\r\n const prepareGlare = function () {\r\n const glarePrerender = this.settings.glarePrerender;\r\n\r\n // If option pre-render is enabled we assume all html/css is present for an optimal glare effect.\r\n if (!glarePrerender)\r\n // Create glare element\r\n $(this).append('
');\r\n\r\n // Store glare selector if glare is enabled\r\n this.glareElementWrapper = $(this).find(\".js-tilt-glare\");\r\n this.glareElement = $(this).find(\".js-tilt-glare-inner\");\r\n\r\n // Remember? We assume all css is already set, so just return\r\n if (glarePrerender) return;\r\n\r\n // Abstracted re-usable glare styles\r\n const stretch = {\r\n 'position': 'absolute',\r\n 'top': '0',\r\n 'left': '0',\r\n 'width': '100%',\r\n 'height': '100%',\r\n };\r\n\r\n // Style glare wrapper\r\n this.glareElementWrapper.css(stretch).css({\r\n 'overflow': 'hidden',\r\n });\r\n\r\n // Style glare element\r\n this.glareElement.css({\r\n 'position': 'absolute',\r\n 'top': '50%',\r\n 'left': '50%',\r\n 'pointer-events': 'none',\r\n 'background-image': `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`,\r\n 'width': `${$(this).outerWidth()*2}`,\r\n 'height': `${$(this).outerWidth()*2}`,\r\n 'transform': 'rotate(180deg) translate(-50%, -50%)',\r\n 'transform-origin': '0% 0%',\r\n 'opacity': '0',\r\n });\r\n\r\n };\r\n\r\n /**\r\n * Update glare on resize\r\n */\r\n const updateGlareSize = function () {\r\n this.glareElement.css({\r\n 'width': `${$(this).outerWidth()*2}`,\r\n 'height': `${$(this).outerWidth()*2}`,\r\n });\r\n };\r\n\r\n /**\r\n * Public methods\r\n */\r\n $.fn.tilt.destroy = function() {\r\n $(this).each(function () {\r\n $(this).find('.js-tilt-glare').remove();\r\n $(this).css({'will-change': '', 'transform': ''});\r\n $(this).off('mousemove mouseenter mouseleave');\r\n });\r\n };\r\n\r\n $.fn.tilt.getValues = function() {\r\n const results = [];\r\n $(this).each(function () {\r\n this.mousePositions = getMousePositions.call(this);\r\n results.push(getValues.call(this));\r\n });\r\n return results;\r\n };\r\n\r\n $.fn.tilt.reset = function() {\r\n $(this).each(function () {\r\n this.mousePositions = getMousePositions.call(this);\r\n this.settings = $(this).data('settings');\r\n mouseLeave.call(this);\r\n setTimeout(() => {\r\n this.reset = false;\r\n }, this.settings.transition);\r\n });\r\n };\r\n\r\n /**\r\n * Loop every instance\r\n */\r\n return this.each(function () {\r\n\r\n /**\r\n * Default settings merged with user settings\r\n * Can be set trough data attributes or as parameter.\r\n * @type {*}\r\n */\r\n this.settings = $.extend({\r\n maxTilt: $(this).is('[data-tilt-max]') ? $(this).data('tilt-max') : 20,\r\n perspective: $(this).is('[data-tilt-perspective]') ? $(this).data('tilt-perspective') : 300,\r\n easing: $(this).is('[data-tilt-easing]') ? $(this).data('tilt-easing') : 'cubic-bezier(.03,.98,.52,.99)',\r\n scale: $(this).is('[data-tilt-scale]') ? $(this).data('tilt-scale') : '1',\r\n speed: $(this).is('[data-tilt-speed]') ? $(this).data('tilt-speed') : '400',\r\n transition: $(this).is('[data-tilt-transition]') ? $(this).data('tilt-transition') : true,\r\n axis: $(this).is('[data-tilt-axis]') ? $(this).data('tilt-axis') : null,\r\n reset: $(this).is('[data-tilt-reset]') ? $(this).data('tilt-reset') : true,\r\n glare: $(this).is('[data-tilt-glare]') ? $(this).data('tilt-glare') : false,\r\n maxGlare: $(this).is('[data-tilt-maxglare]') ? $(this).data('tilt-maxglare') : 1,\r\n }, options);\r\n\r\n\r\n this.init = () => {\r\n // Store settings\r\n $(this).data('settings', this.settings);\r\n\r\n // Prepare element\r\n if(this.settings.glare) prepareGlare.call(this);\r\n\r\n // Bind events\r\n bindEvents.call(this);\r\n };\r\n\r\n // Init\r\n this.init();\r\n\r\n });\r\n };\r\n\r\n /**\r\n * Auto load\r\n */\r\n $('[data-tilt]').tilt();\r\n\r\n}(jQuery));\r\n"]}