@code-hike/smooth-lines
Advanced tools
Comparing version 0.0.0-6a7ffe8 to 0.0.0-a3f5be4
@@ -109,2 +109,3 @@ 'use strict'; | ||
exitIndex: !nextLine ? exitIndex++ : null, | ||
elementWithProgress: (prevLine === null || prevLine === void 0 ? void 0 : prevLine.elementWithProgress) || (nextLine === null || nextLine === void 0 ? void 0 : nextLine.elementWithProgress), | ||
}; | ||
@@ -114,3 +115,2 @@ }); | ||
var exitCount = exitIndex; | ||
// console.log({ linesData }) | ||
return linesData.map(function (lineData) { | ||
@@ -121,3 +121,3 @@ return getLineTransition(lineData, enterCount, exitCount); | ||
function getLineTransition(_a, enterCount, exitCount) { | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex; | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex, elementWithProgress = _a.elementWithProgress; | ||
// startY is the progress when we start moving vertically | ||
@@ -130,2 +130,3 @@ // endY is when we stop | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -145,2 +146,3 @@ tweenY: { fixed: true, value: nextIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -158,2 +160,3 @@ tweenY: { fixed: true, value: prevIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -234,3 +237,3 @@ tweenY: { | ||
} }, lines.map(function (_a) { | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY; | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY, elementWithProgress = _a.elementWithProgress; | ||
var dx = tween(tweenX, progress); | ||
@@ -257,3 +260,5 @@ var dy = tween(tweenY, progress); | ||
opacity: opacity, | ||
} }, element)); | ||
} }, elementWithProgress | ||
? elementWithProgress(progress) | ||
: element)); | ||
})))); | ||
@@ -260,0 +265,0 @@ } |
@@ -101,2 +101,3 @@ import React, { useMemo } from 'react'; | ||
exitIndex: !nextLine ? exitIndex++ : null, | ||
elementWithProgress: (prevLine === null || prevLine === void 0 ? void 0 : prevLine.elementWithProgress) || (nextLine === null || nextLine === void 0 ? void 0 : nextLine.elementWithProgress), | ||
}; | ||
@@ -106,3 +107,2 @@ }); | ||
var exitCount = exitIndex; | ||
// console.log({ linesData }) | ||
return linesData.map(function (lineData) { | ||
@@ -113,3 +113,3 @@ return getLineTransition(lineData, enterCount, exitCount); | ||
function getLineTransition(_a, enterCount, exitCount) { | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex; | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex, elementWithProgress = _a.elementWithProgress; | ||
// startY is the progress when we start moving vertically | ||
@@ -122,2 +122,3 @@ // endY is when we stop | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -137,2 +138,3 @@ tweenY: { fixed: true, value: nextIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -150,2 +152,3 @@ tweenY: { fixed: true, value: prevIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -226,3 +229,3 @@ tweenY: { | ||
} }, lines.map(function (_a) { | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY; | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY, elementWithProgress = _a.elementWithProgress; | ||
var dx = tween(tweenX, progress); | ||
@@ -249,3 +252,5 @@ var dy = tween(tweenY, progress); | ||
opacity: opacity, | ||
} }, element)); | ||
} }, elementWithProgress | ||
? elementWithProgress(progress) | ||
: element)); | ||
})))); | ||
@@ -252,0 +257,0 @@ } |
@@ -109,2 +109,3 @@ (function (global, factory) { | ||
exitIndex: !nextLine ? exitIndex++ : null, | ||
elementWithProgress: (prevLine === null || prevLine === void 0 ? void 0 : prevLine.elementWithProgress) || (nextLine === null || nextLine === void 0 ? void 0 : nextLine.elementWithProgress), | ||
}; | ||
@@ -114,3 +115,2 @@ }); | ||
var exitCount = exitIndex; | ||
// console.log({ linesData }) | ||
return linesData.map(function (lineData) { | ||
@@ -121,3 +121,3 @@ return getLineTransition(lineData, enterCount, exitCount); | ||
function getLineTransition(_a, enterCount, exitCount) { | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex; | ||
var element = _a.element, key = _a.key, prevIndex = _a.prevIndex, nextIndex = _a.nextIndex, enterIndex = _a.enterIndex, exitIndex = _a.exitIndex, elementWithProgress = _a.elementWithProgress; | ||
// startY is the progress when we start moving vertically | ||
@@ -130,2 +130,3 @@ // endY is when we stop | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -145,2 +146,3 @@ tweenY: { fixed: true, value: nextIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -158,2 +160,3 @@ tweenY: { fixed: true, value: prevIndex }, | ||
element: element, | ||
elementWithProgress: elementWithProgress, | ||
key: key, | ||
@@ -234,3 +237,3 @@ tweenY: { | ||
} }, lines.map(function (_a) { | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY; | ||
var element = _a.element, key = _a.key, tweenX = _a.tweenX, tweenY = _a.tweenY, elementWithProgress = _a.elementWithProgress; | ||
var dx = tween(tweenX, progress); | ||
@@ -257,3 +260,5 @@ var dy = tween(tweenY, progress); | ||
opacity: opacity, | ||
} }, element)); | ||
} }, elementWithProgress | ||
? elementWithProgress(progress) | ||
: element)); | ||
})))); | ||
@@ -260,0 +265,0 @@ } |
@@ -7,2 +7,3 @@ /// <reference types="react" /> | ||
element: Element; | ||
elementWithProgress?: (progress: number) => Element; | ||
key: Key; | ||
@@ -12,2 +13,3 @@ }; | ||
element: React.ReactNode; | ||
elementWithProgress?: (progress: number) => Element; | ||
key: number; | ||
@@ -14,0 +16,0 @@ tweenY: TweenParams; |
{ | ||
"name": "@code-hike/smooth-lines", | ||
"version": "0.0.0-6a7ffe8", | ||
"version": "0.0.0-a3f5be4", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "typings": "dist/index.d.ts", |
35054
796