forked from davidjerleke/embla-carousel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1622-2333e4a6c4412edbbb07.js.map
1 lines (1 loc) · 2.01 KB
/
1622-2333e4a6c4412edbbb07.js.map
1
{"version":3,"file":"1622-2333e4a6c4412edbbb07.js","mappings":"uIAAA,6tD","sources":["webpack://embla-carousel-docs/./src/components/Sandbox/Vanilla/SandboxFilesDist/Opacity/tween-opacity.js"],"sourcesContent":["export default \"\\nconst TWEEN_FACTOR = 4.2;\\n\\nconst numberWithinRange = (number, min, max) => Math.min(Math.max(number, min), max);\\n\\nconst calculateTweenValuesOpacity = (emblaApi) => {\\n const engine = emblaApi.internalEngine();\\n const scrollProgress = emblaApi.scrollProgress();\\n \\n return emblaApi.scrollSnapList().map((scrollSnap, index) => {\\n if (!emblaApi.slidesInView().includes(index))\\n return 0;\\n let diffToTarget = scrollSnap - scrollProgress;\\n \\n if (engine.options.loop) {\\n engine.slideLooper.loopPoints.forEach((loopItem) => {\\n const target = loopItem.target();\\n if (index === loopItem.index && target !== 0) {\\n const sign = Math.sign(target);\\n if (sign === -1)\\n diffToTarget = scrollSnap - (1 + scrollProgress);\\n if (sign === 1)\\n diffToTarget = scrollSnap + (1 - scrollProgress);\\n }\\n });\\n }\\n const tweenValue = 1 - Math.abs(diffToTarget * TWEEN_FACTOR);\\n return numberWithinRange(tweenValue, 0, 1);\\n });\\n};\\n\\nexport const setupTweenOpacity = (emblaApi) => {\\n const tweenNodes = emblaApi.slideNodes();\\n \\n const applyTweenOpacity = () => {\\n const tweenValues = calculateTweenValuesOpacity(emblaApi);\\n tweenValues.forEach((tweenValue, index) => {\\n tweenNodes[index].style.opacity = tweenValue.toString();\\n });\\n };\\n \\n const removeTweenOpacity = () => {\\n tweenNodes.forEach((slide) => slide.removeAttribute('style'));\\n };\\n \\n return {\\n applyTweenOpacity,\\n removeTweenOpacity\\n };\\n};\\n\";"],"names":[],"sourceRoot":""}