Skip to content

Commit

Permalink
feat(coverflow) : allow function modifier (#5502)
Browse files Browse the repository at this point in the history
  • Loading branch information
Grafikart authored Mar 4, 2022
1 parent 95c882c commit 3527355
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/modules/effect-coverflow/effect-coverflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ export default function EffectCoverflow({ swiper, extendParams, on }) {
const $slideEl = slides.eq(i);
const slideSize = slidesSizesGrid[i];
const slideOffset = $slideEl[0].swiperSlideOffset;
const offsetMultiplier =
((center - slideOffset - slideSize / 2) / slideSize) * params.modifier;
const centerOffset = (center - slideOffset - slideSize / 2) / slideSize
const offsetMultiplier =
typeof params.modifier === 'function' ?
params.modifier(centerOffset) :
centerOffset * params.modifier;

let rotateY = isHorizontal ? rotate * offsetMultiplier : 0;
let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier;
Expand Down

0 comments on commit 3527355

Please sign in to comment.