Newer
Older
pre-www / build / assets / js / vendor / swiper / modules / effect-coverflow.min.mjs
import{c as createShadow}from"../shared/create-shadow.min.mjs";import{e as effectInit}from"../shared/effect-init.min.mjs";import{e as effectTarget}from"../shared/effect-target.min.mjs";import{l as getSlideTransformEl}from"../shared/utils.min.mjs";function EffectCoverflow(e){let{swiper:t,extendParams:s,on:r}=e;s({coverflowEffect:{rotate:50,stretch:0,depth:100,scale:1,modifier:1,slideShadows:!0}});effectInit({effect:"coverflow",swiper:t,on:r,setTranslate:()=>{const{width:e,height:s,slides:r,slidesSizesGrid:a}=t,o=t.params.coverflowEffect,i=t.isHorizontal(),l=t.translate,f=i?e/2-l:s/2-l,d=i?o.rotate:-o.rotate,h=o.depth;for(let e=0,s=r.length;e<s;e+=1){const s=r[e],l=a[e],c=(f-s.swiperSlideOffset-l/2)/l,n="function"==typeof o.modifier?o.modifier(c):c*o.modifier;let w=i?d*n:0,p=i?0:d*n,m=-h*Math.abs(n),b=o.stretch;"string"==typeof b&&-1!==b.indexOf("%")&&(b=parseFloat(o.stretch)/100*l);let S=i?0:b*n,y=i?b*n:0,g=1-(1-o.scale)*Math.abs(n);Math.abs(y)<.001&&(y=0),Math.abs(S)<.001&&(S=0),Math.abs(m)<.001&&(m=0),Math.abs(w)<.001&&(w=0),Math.abs(p)<.001&&(p=0),Math.abs(g)<.001&&(g=0),t.browser&&t.browser.isSafari&&(Math.abs(w)/90%2==1&&(w+=.001),Math.abs(p)/90%2==1&&(p+=.001));const u=`translate3d(${y}px,${S}px,${m}px)  rotateX(${p}deg) rotateY(${w}deg) scale(${g})`;if(effectTarget(o,s).style.transform=u,s.style.zIndex=1-Math.abs(Math.round(n)),o.slideShadows){let e=i?s.querySelector(".swiper-slide-shadow-left"):s.querySelector(".swiper-slide-shadow-top"),t=i?s.querySelector(".swiper-slide-shadow-right"):s.querySelector(".swiper-slide-shadow-bottom");e||(e=createShadow("coverflow",s,i?"left":"top")),t||(t=createShadow("coverflow",s,i?"right":"bottom")),e&&(e.style.opacity=n>0?n:0),t&&(t.style.opacity=-n>0?-n:0)}}},setTransition:e=>{t.slides.map((e=>getSlideTransformEl(e))).forEach((t=>{t.style.transitionDuration=`${e}ms`,t.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach((t=>{t.style.transitionDuration=`${e}ms`}))}))},perspective:()=>!0,overwriteParams:()=>({watchSlidesProgress:!0})})}export{EffectCoverflow as default};
//# sourceMappingURL=effect-coverflow.min.mjs.map