page-transition 0.1.0-beta.39 → 0.1.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -134,6 +134,7 @@ export function CssTransitionProvider({ header, options, children }) {
|
|
|
134
134
|
}
|
|
135
135
|
if (duration.current === null) {
|
|
136
136
|
duration.current = parseDuration(transitionEndData.current.elArray[0]);
|
|
137
|
+
duration.current = (duration.current ?? 0) * 1000 / 2;
|
|
137
138
|
}
|
|
138
139
|
}, [pathname]);
|
|
139
140
|
const value = useMemo(() => ({ handleLinkClick, overlayWrapper, overlayItems }), []);
|
|
@@ -3,7 +3,7 @@ export function setPlaybackRate({ elArray, transitionProperty, value }) {
|
|
|
3
3
|
el?.getAnimations().forEach((obj) => {
|
|
4
4
|
if (obj instanceof CSSTransition &&
|
|
5
5
|
obj.transitionProperty === transitionProperty) {
|
|
6
|
-
obj.
|
|
6
|
+
obj.playbackRate = value;
|
|
7
7
|
}
|
|
8
8
|
});
|
|
9
9
|
});
|
|
@@ -3,9 +3,8 @@ export function updatePlaybackRate({ rafId, rejectFn, elArray, transitionPropert
|
|
|
3
3
|
cancelAnimationFrame(rafId.current);
|
|
4
4
|
if (duration === 0)
|
|
5
5
|
return Promise.resolve();
|
|
6
|
-
const d = (duration * 1000) / 2;
|
|
7
6
|
let progress = 0;
|
|
8
|
-
let summ = target ? 0 :
|
|
7
|
+
let summ = target ? 0 : duration;
|
|
9
8
|
let animationArray = [];
|
|
10
9
|
elArray.forEach((el) => {
|
|
11
10
|
el?.getAnimations().forEach((obj) => {
|
|
@@ -25,10 +24,17 @@ export function updatePlaybackRate({ rafId, rejectFn, elArray, transitionPropert
|
|
|
25
24
|
}
|
|
26
25
|
const dt = Math.min(now - before, 30);
|
|
27
26
|
before = now;
|
|
28
|
-
summ = target ? Math.min(summ + dt,
|
|
29
|
-
progress = summ /
|
|
27
|
+
summ = target ? Math.min(summ + dt, duration) : Math.max(summ - dt, 0);
|
|
28
|
+
progress = summ / duration;
|
|
30
29
|
animationArray.forEach((obj) => {
|
|
31
30
|
obj.updatePlaybackRate(progress);
|
|
31
|
+
console.log("AFTER", {
|
|
32
|
+
meinProg: progress,
|
|
33
|
+
rate: obj.playbackRate,
|
|
34
|
+
currentTime: obj.currentTime,
|
|
35
|
+
playState: obj.playState,
|
|
36
|
+
startTime: obj.startTime,
|
|
37
|
+
});
|
|
32
38
|
});
|
|
33
39
|
if (target && progress >= 1 || !target && progress <= 0) {
|
|
34
40
|
if (rafId.current !== null) {
|