Transition: Fixes for frozen heavy animation
This commit is contained in:
parent
03eaacf5aa
commit
dea730f573
@ -23,32 +23,6 @@
|
|||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* scroll-slide
|
|
||||||
*/
|
|
||||||
|
|
||||||
&.scroll-slide {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
|
|
||||||
> * {
|
|
||||||
position: static;
|
|
||||||
flex-shrink: 0;
|
|
||||||
|
|
||||||
&:not(.active):not(.from):not(.to) {
|
|
||||||
display: block !important;
|
|
||||||
transform: scale(0);
|
|
||||||
|
|
||||||
&.through {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* slide
|
* slide
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -51,7 +51,7 @@ const Transition: FC<OwnProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
// No need for a container to update on change
|
// No need for a container to update on change
|
||||||
const { animationLevel } = getGlobal().settings.byKey;
|
const { animationLevel } = getGlobal().settings.byKey;
|
||||||
const currentIndexRef = useRef<number>();
|
const currentKeyRef = useRef<number>();
|
||||||
|
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
let containerRef = useRef<HTMLDivElement>(null);
|
let containerRef = useRef<HTMLDivElement>(null);
|
||||||
@ -147,7 +147,9 @@ const Transition: FC<OwnProps> = ({
|
|||||||
|
|
||||||
function onAnimationEnd() {
|
function onAnimationEnd() {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (activeIndex !== currentIndexRef.current) return;
|
if (activeKey !== currentKeyRef.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
container.classList.remove('animating', 'backwards');
|
container.classList.remove('animating', 'backwards');
|
||||||
|
|
||||||
@ -179,14 +181,16 @@ const Transition: FC<OwnProps> = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const toNode = name === 'mv-slide'
|
const watchedNode = name === 'mv-slide'
|
||||||
? childNodes[activeIndex] && childNodes[activeIndex].firstChild
|
? childNodes[activeIndex] && childNodes[activeIndex].firstChild
|
||||||
: childNodes[activeIndex];
|
: name === 'reveal' && isBackwards
|
||||||
|
? childNodes[prevActiveIndex]
|
||||||
|
: childNodes[activeIndex];
|
||||||
|
|
||||||
currentIndexRef.current = activeKey;
|
currentKeyRef.current = activeKey;
|
||||||
|
|
||||||
if (animationLevel > 0 && toNode) {
|
if (animationLevel > 0 && watchedNode) {
|
||||||
waitForAnimationEnd(toNode, onAnimationEnd);
|
waitForAnimationEnd(watchedNode, onAnimationEnd);
|
||||||
} else {
|
} else {
|
||||||
onAnimationEnd();
|
onAnimationEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user