This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates a helper function to create looping carousel slides. | |
// @param {number} arrIndex - Index of slide in array (starting from 0) | |
// @param {number} arrLength - The number of slides in the carousel | |
// @returns {function} offset - The helper function. | |
export const steps = (arrIndex, arrLength) => (progress) => { | |
const wraps = ((arrIndex + 1) - progress) / arrLength | |
const flooredWraps = Math.floor(wraps) | |
return 0 - flooredWraps |
OlderNewer