1.0 KiB
1.0 KiB
Entrance Animation Fix
Objective
Ensure the card preview plays the "scale-up fade-in" animation when it first appears (mounting), not just when disappearing.
Changes
- Modified
FloatingPreviewinsrc/client/src/components/CardPreview.tsx:- Introduced a generic
isMountedstate initialized tofalse. - Added a
useEffectthat setsisMountedtotrueon the next animation frame after mount. - Updated CSS logic to check a combined
isActivestate (isMounted && !isClosing). - Logic:
- Mount (0ms):
isActiveis false->opacity-0 scale-95. - Next Frame (~16ms):
isMountedbecomes true->isActivebecomes true->transition-alltriggers toopacity-100 scale-100. - Unmount Trigger:
isClosingbecomes true->isActivebecomes false->Transitions back toopacity-0 scale-95.
- Mount (0ms):
- Introduced a generic
Result
The card preview now smoothly "pops in" from 95% scale and 0 opacity every time it is triggered, providing a consistent, high-quality feel to the UI interactions.