diff --git a/src/components/OverlapReveal.astro b/src/components/OverlapReveal.astro index 861661c..742d859 100644 --- a/src/components/OverlapReveal.astro +++ b/src/components/OverlapReveal.astro @@ -11,7 +11,7 @@ // expand clip path from ltr depending on fraction (0 to 1) function setBottomElClipPath(fraction: number) { currentFraction = fraction; - bottomEl.style.clipPath = `polygon(0px 0px, ${fraction * 100}% 0px, ${fraction * 100}% 100%, 0% 100%)`; + bottomEl.style.clipPath = `polygon(0px 0px, ${currentFraction * 100}% 0px, ${currentFraction * 100}% 100%, 0% 100%)`; } // set the container's height to the tallest element's height @@ -106,12 +106,15 @@ } // increment by 10% else if (ev.key === "ArrowRight" && currentFraction < 1) { - setBottomElClipPath(currentFraction + 0.1); + const newFraction = Number((currentFraction + 0.1).toFixed(1)); + setBottomElClipPath(newFraction); } // decrement by 10% else if (ev.key === "ArrowLeft" && currentFraction >= 0) { - setBottomElClipPath(currentFraction - 0.1); + const newFraction = Number((currentFraction - 0.1).toFixed(1)); + setBottomElClipPath(newFraction); } + console.log(currentFraction); if (canAnimate) { // redisable transitions