Skip to content

Commit

Permalink
Add shrink and blur transition to deleted node
Browse files Browse the repository at this point in the history
  • Loading branch information
zukilover committed Nov 17, 2024
1 parent 0eff9c0 commit 3329347
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,34 @@
transition: opacity 80ms ease-out;
}

/* react-transition-group animation: very-fast-morph
* Morph transition (a combination of fade, blur, and scale)
*/
.very-fast-morph-enter {
opacity: 0;
}

.very-fast-morph-enter-active {
opacity: 1;
transition: opacity 80ms ease-out;
}

/* Exit transition (animation occurs only when exiting) */
.very-fast-morph-exit {
opacity: 1;
transform: scale3d(1, 1, 1);
filter: blur(0);
transform-origin: center;
}

.very-fast-morph-exit-active {
opacity: 0; /* Fade out */
transform: scale3d(0.5, 0.5, 0.5); /* Shrink */
filter: blur(4px); /* Apply blur */
transform-origin: center; /* Ensure the scaling is centered */
transition: opacity 80ms ease-out, transform 80ms ease-out, filter 80ms ease-out;
}

/* react-transition-group animation: fade-slow-out */
.fade-slow-out-enter {
opacity: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/components/LayoutTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ const LayoutTree = () => {
nodeRef={nodeRef}
key={key}
timeout={durations.get('veryFastDuration')}
classNames='very-fast-fade'
classNames='very-fast-morph'
unmountOnExit
>
<div
Expand Down

0 comments on commit 3329347

Please sign in to comment.