/** * Atropos 1.0.2 * Touch-friendly 3D parallax hover effects * http://atroposjs.com * * Copyright 2021-2022 * * Released under the MIT License * * Released on: February 17, 2022 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Atropos=e()}(this,(function(){"use strict";function t(){return(t=Object.assign||function(t){for(var e=1;e=25){var r=180*Math.atan2(Math.abs(n),Math.abs(a))/Math.PI;l="scroll-y"===M.rotateTouch?r>45:90-r>45}!1===l&&(m.classList.add("atropos-rotate-touch"),t.cancelable&&t.preventDefault())}"mouse"!==t.pointerType&&l||A(e,o)}},j=function(t){if(s=void 0,c=void 0,g.isActive&&!(t&&"pointerup"===t.type&&"mouse"===t.pointerType||t&&"pointerleave"===t.type&&"mouse"!==t.pointerType)){if("string"==typeof M.rotateTouch&&l&&m.classList.remove("atropos-rotate-touch"),M.alwaysActive)return A(),"function"==typeof M.onRotate&&M.onRotate(0,0),void("function"==typeof M.onLeave&&M.onLeave());x.push((function(){return m.classList.remove("atropos-active")})),O(r,M.duration+"ms"),b(r,""),T(r,"translate3d(0,0, 0px)"),u&&(O(u,M.duration+"ms"),b(u,"")),p&&(O(p,M.duration+"ms"),b(p,""),T(p,"translate3d(0, 0, 0)"),X(p,0)),O(n,M.duration+"ms"),b(n,""),T(n,"translate3d(0,0,0) rotateX(0deg) rotateY(0deg)"),L({duration:M.duration+"ms"}),g.isActive=!1,"function"==typeof M.onRotate&&M.onRotate(0,0),"function"==typeof M.onLeave&&M.onLeave()}},D=function(t){var e=t.target;!y.contains(e)&&e!==y&&g.isActive&&j()};return g.destroy=function(){g.destroyed=!0,cancelAnimationFrame(v),_(document,"click",D),_(y,"pointerdown",R),_(y,"pointerenter",R),_(y,"pointermove",P),_(y,"touchmove",I),_(y,"pointerleave",j),_(y,"pointerup",j),_(y,"lostpointercapture",j),delete m.__atropos__},"string"==typeof m&&(m=e(document,m)),m&&(m.__atropos__||(void 0!==y?"string"==typeof y&&(y=e(document,y)):y=m,Object.assign(g,{el:m}),n=e(m,".atropos-rotate"),r=e(m,".atropos-scale"),i=e(m,".atropos-inner"),m.__atropos__=g)),m&&y&&(M.shadow&&((u=e(m,".atropos-shadow"))||((u=document.createElement("span")).classList.add("atropos-shadow"),w=!0),T(u,"translate3d(0,0,-"+M.shadowOffset+"px) scale("+M.shadowScale+")"),w&&n.appendChild(u)),M.highlight&&function(){var t;(p=e(m,".atropos-highlight"))||((p=document.createElement("span")).classList.add("atropos-highlight"),t=!0),T(p,"translate3d(0,0,0)"),t&&i.appendChild(p)}(),M.rotateTouch&&("string"==typeof M.rotateTouch?m.classList.add("atropos-rotate-touch-"+M.rotateTouch):m.classList.add("atropos-rotate-touch")),e(m,"[data-atropos-opacity]")&&L({opacityOnly:!0}),Y(document,"click",D),Y(y,"pointerdown",R),Y(y,"pointerenter",R),Y(y,"pointermove",P),Y(y,"touchmove",I),Y(y,"pointerleave",j),Y(y,"pointerup",j),Y(y,"lostpointercapture",j),M.alwaysActive&&(E(),A())),g}})); //# sourceMappingURL=atropos.min.js.map