Added animation to nodes appearing/disappearing

This commit is contained in:
thepaperpilot 2021-08-26 00:13:42 -05:00
parent ae0fbd09eb
commit af57840dc6

View file

@ -44,8 +44,8 @@
</g>
</transition>
<transition name="grow" appear>
<g
v-if="shape === Shape.Circle"
@mouseenter="mouseEnter"
@mouseleave="mouseLeave"
@mousedown="mouseDown"
@ -53,6 +53,7 @@
@mouseup="mouseUp"
@touchend="mouseUp"
>
<g v-if="shape === Shape.Circle">
<circle
v-if="canAccept"
:r="size + 8"
@ -81,22 +82,14 @@
:stroke="progressColor"
/>
</g>
<g
v-else-if="shape === Shape.Diamond"
transform="rotate(45, 0, 0)"
@mouseenter="mouseEnter"
@mouseleave="mouseLeave"
@mousedown="mouseDown"
@touchstart="mouseDown"
@mouseup="mouseUp"
@touchend="mouseUp"
>
<g v-else-if="shape === Shape.Diamond" transform="rotate(45, 0, 0)">
<rect
v-if="canAccept"
:width="size * sqrtTwo + 16"
:height="size * sqrtTwo + 16"
:transform="
`translate(${-(size * sqrtTwo + 16) / 2}, ${-(size * sqrtTwo + 16) / 2})`
`translate(${-(size * sqrtTwo + 16) / 2}, ${-(size * sqrtTwo + 16) /
2})`
"
:fill="backgroundColor"
:stroke="receivingNode ? '#0F0' : '#0F03'"
@ -117,10 +110,8 @@
:width="Math.max(size * sqrtTwo * progress - 2, 0)"
:height="Math.max(size * sqrtTwo * progress - 2, 0)"
:transform="
`translate(${-Math.max(size * sqrtTwo * progress - 2, 0) / 2}, ${-Math.max(
size * sqrtTwo * progress - 2,
0
) / 2})`
`translate(${-Math.max(size * sqrtTwo * progress - 2, 0) /
2}, ${-Math.max(size * sqrtTwo * progress - 2, 0) / 2})`
"
:fill="progressColor"
/>
@ -128,16 +119,22 @@
v-else
:width="size * sqrtTwo + 9"
:height="size * sqrtTwo + 9"
:transform="`translate(${-(size * sqrtTwo + 9) / 2}, ${-(size * sqrtTwo + 9) / 2})`"
:transform="
`translate(${-(size * sqrtTwo + 9) / 2}, ${-(size * sqrtTwo + 9) / 2})`
"
fill="transparent"
:stroke-dasharray="(size * sqrtTwo + 9) * 4"
:stroke-width="5"
:stroke-dashoffset="(size * sqrtTwo + 9) * 4 - progress * (size * sqrtTwo + 9) * 4"
:stroke-dashoffset="
(size * sqrtTwo + 9) * 4 - progress * (size * sqrtTwo + 9) * 4
"
:stroke="progressColor"
/>
</g>
<text :fill="titleColor" class="node-title">{{ title }}</text>
</g>
</transition>
<transition name="fade" appear>
<text
@ -389,6 +386,11 @@ export default defineComponent({
opacity: 0.25;
}
}
.grow-enter-from,
.fade-leave-to {
transform: scale(0);
}
</style>
<style>