From f0548cc2bc4438e10a3eefb0911253072c91e491 Mon Sep 17 00:00:00 2001 From: yindongqi Date: Fri, 8 Aug 2025 14:39:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=A7=86=E5=9B=BE):=20=E4=B8=BA=E5=85=B3?= =?UTF-8?q?=E8=81=94=E5=85=B3=E7=B3=BB=E5=9B=BE=E6=B7=BB=E5=8A=A0=E5=BC=B9?= =?UTF-8?q?=E5=87=BA=E5=92=8C=E6=94=B6=E5=9B=9E=E5=8A=A8=E7=94=BB=E6=95=88?= =?UTF-8?q?=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加动画状态管理变量 isAnimating,并实现平滑的弹出和收回动画效果 修改关联关系图的显示逻辑,在动画播放期间保持元素可见 添加 CSS 动画关键帧和样式类来处理动画效果 --- src/views/shanghaiStreetMapDasai.vue | 84 ++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 6 deletions(-) diff --git a/src/views/shanghaiStreetMapDasai.vue b/src/views/shanghaiStreetMapDasai.vue index e5dc4cb..f9c8909 100644 --- a/src/views/shanghaiStreetMapDasai.vue +++ b/src/views/shanghaiStreetMapDasai.vue @@ -323,7 +323,7 @@ + :resizable="resizableBoolean" v-show="!relationShow && !isAnimating">
@@ -338,8 +338,15 @@
+ class="flex items-center justify-center w-96 h-48 border-2 border-dashed rounded border-gray-500 overflow-hidden z-[999] fixed bottom-10 right-7" + ref="main9" + :class="{ + 'animate-popup': isAnimating && relationShow, + 'animate-shrink': isAnimating && !relationShow, + 'opacity-0 scale-0': !relationShow && !isAnimating + }" + v-show="relationShow || isAnimating" + style="transform-origin: bottom right;">
@@ -369,7 +376,7 @@ @@ -4372,4 +4395,53 @@ const handleFancyClick = (e: MouseEvent) => { opacity: 1; transition: transform 0.5s, opacity 0.5s; } + +/* 弹出动画 */ +@keyframes popup { + 0% { + opacity: 0; + transform: scale(0) translate(0, 0); + } + 50% { + opacity: 0.8; + transform: scale(0.8) translate(0, -20px); + } + 100% { + opacity: 1; + transform: scale(1) translate(0, 0); + } +} + +/* 收回动画 */ +@keyframes shrink { + 0% { + opacity: 1; + transform: scale(1) translate(0, 0); + } + 50% { + opacity: 0.8; + transform: scale(0.8) translate(0, -20px); + } + 100% { + opacity: 0; + transform: scale(0) translate(0, 0); + } +} + +.animate-popup { + animation: popup 0.3s ease-out forwards; + transform-origin: bottom right; +} + +.animate-shrink { + animation: shrink 0.3s ease-in forwards; + transform-origin: bottom right; +} + +/* 初始状态 - 隐藏且缩放为0 */ +.opacity-0.scale-0 { + opacity: 0 !important; + transform: scale(0) !important; + transition: none !important; +}