Skip to content

🎥 Make videos programmatically with React

Synchronize blur slide strength with swipe travel

JonnyBurgera1b2b729b733
diff --git a/packages/docs/docs/transitions/presentations/blur-slide.mdx b/packages/docs/docs/transitions/presentations/blur-slide.mdx
index 9c5c5d72cf..deffcea738 100644
--- a/packages/docs/docs/transitions/presentations/blur-slide.mdx
+++ b/packages/docs/docs/transitions/presentations/blur-slide.mdx
@@ -64,6 +64,8 @@ const BasicTransition = () => {
The slide is eased so that it starts and ends at rest. [`linearTiming()`](/docs/transitions/timings/lineartiming) is a good choice for this presentation.
+The blur grows in proportion to the distance traveled during the first half of the slide, then shrinks in proportion to the distance remaining during the second half.
+
## API
Accepts an object with the following options:
diff --git a/packages/docs/static/img/blur-slide-transition-thumb.mp4 b/packages/docs/static/img/blur-slide-transition-thumb.mp4
index 4487d6c5eb..9a85052cbe 100644
Binary files a/packages/docs/static/img/blur-slide-transition-thumb.mp4 and b/packages/docs/static/img/blur-slide-transition-thumb.mp4 differ
diff --git a/packages/docs/static/img/blur-slide-transition.mp4 b/packages/docs/static/img/blur-slide-transition.mp4
index 8b2f686da1..b07fbb4d12 100644
Binary files a/packages/docs/static/img/blur-slide-transition.mp4 and b/packages/docs/static/img/blur-slide-transition.mp4 differ
diff --git a/packages/transitions/src/presentations/blur-slide.tsx b/packages/transitions/src/presentations/blur-slide.tsx
index 6b2f2d9323..a8c25f651f 100644
--- a/packages/transitions/src/presentations/blur-slide.tsx
+++ b/packages/transitions/src/presentations/blur-slide.tsx
@@ -306,11 +306,10 @@ export const blurSlideShader = (
const effectiveTime = !prevImage ? 0 : !nextImage ? 1 : time;
const p = 1 - effectiveTime;
// Ease the slide with a quintic curve so that it starts and ends at rest.
- // The blur follows the speed of that curve, normalized to peak at 1
- // halfway through, so the scenes stay sharp longer at both ends.
+ // The blur follows the distance traveled until the midpoint, then the
+ // distance remaining, normalized to peak at 1 halfway through.
const progress = p * p * p * (p * (p * 6 - 15) + 10);
- const velocity = (4 * p * (1 - p)) ** 2;
- const blurLength = blur * velocity;
+ const blurLength = blur * 2 * Math.min(progress, 1 - progress);
const coarseTapSpacing = blurLength / (SAMPLES - 1);
const [dirX, dirY] = getDirectionVector(direction);