cione-comp-lib
Version:
`$ yarn add cione-comp-lib` 或者 `$ npm i cione-comp-lib -S`
2 lines (1 loc) • 2.5 kB
JavaScript
;Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),require("../../utils/dom.js");var e=require("../../utils/utils.js"),s=require("../../../../dom7/dom7.esm.js");function t(){return t=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},t.apply(this,arguments)}var a={setTranslate:function(){for(var e=this,t=e.width,a=e.height,r=e.slides,i=e.slidesSizesGrid,o=e.params.coverflowEffect,l=e.isHorizontal(),d=e.translate,n=l?t/2-d:a/2-d,f=l?o.rotate:-o.rotate,c=o.depth,h=0,p=r.length;h<p;h+=1){var w=r.eq(h),u=i[h],v=(n-w[0].swiperSlideOffset-u/2)/u*o.modifier,m=l?f*v:0,g=l?0:f*v,b=-c*Math.abs(v),M=o.stretch;"string"==typeof M&&-1!==M.indexOf("%")&&(M=parseFloat(o.stretch)/100*u);var y=l?0:M*v,S=l?M*v:0,x=1-(1-o.scale)*Math.abs(v);Math.abs(S)<.001&&(S=0),Math.abs(y)<.001&&(y=0),Math.abs(b)<.001&&(b=0),Math.abs(m)<.001&&(m=0),Math.abs(g)<.001&&(g=0),Math.abs(x)<.001&&(x=0);var T="translate3d("+S+"px,"+y+"px,"+b+"px) rotateX("+g+"deg) rotateY("+m+"deg) scale("+x+")";if(w.transform(T),w[0].style.zIndex=1-Math.abs(Math.round(v)),o.slideShadows){var j=l?w.find(".swiper-slide-shadow-left"):w.find(".swiper-slide-shadow-top"),O=l?w.find(".swiper-slide-shadow-right"):w.find(".swiper-slide-shadow-bottom");0===j.length&&(j=s.default('<div class="swiper-slide-shadow-'+(l?"left":"top")+'"></div>'),w.append(j)),0===O.length&&(O=s.default('<div class="swiper-slide-shadow-'+(l?"right":"bottom")+'"></div>'),w.append(O)),j.length&&(j[0].style.opacity=v>0?v:0),O.length&&(O[0].style.opacity=-v>0?-v:0)}}},setTransition:function(e){this.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}},r={name:"effect-coverflow",params:{coverflowEffect:{rotate:50,stretch:0,depth:100,scale:1,modifier:1,slideShadows:!0}},create:function(){e.bindModuleMethods(this,{coverflowEffect:t({},a)})},on:{beforeInit:function(e){"coverflow"===e.params.effect&&(e.classNames.push(e.params.containerModifierClass+"coverflow"),e.classNames.push(e.params.containerModifierClass+"3d"),e.params.watchSlidesProgress=!0,e.originalParams.watchSlidesProgress=!0)},setTranslate:function(e){"coverflow"===e.params.effect&&e.coverflowEffect.setTranslate()},setTransition:function(e,s){"coverflow"===e.params.effect&&e.coverflowEffect.setTransition(s)}}};exports.default=r;