Added animation to nodes appearing/disappearing
This commit is contained in:
parent
ae0fbd09eb
commit
af57840dc6
1 changed files with 91 additions and 89 deletions
|
@ -44,100 +44,97 @@
|
||||||
</g>
|
</g>
|
||||||
</transition>
|
</transition>
|
||||||
|
|
||||||
<g
|
<transition name="grow" appear>
|
||||||
v-if="shape === Shape.Circle"
|
<g
|
||||||
@mouseenter="mouseEnter"
|
@mouseenter="mouseEnter"
|
||||||
@mouseleave="mouseLeave"
|
@mouseleave="mouseLeave"
|
||||||
@mousedown="mouseDown"
|
@mousedown="mouseDown"
|
||||||
@touchstart="mouseDown"
|
@touchstart="mouseDown"
|
||||||
@mouseup="mouseUp"
|
@mouseup="mouseUp"
|
||||||
@touchend="mouseUp"
|
@touchend="mouseUp"
|
||||||
>
|
>
|
||||||
<circle
|
<g v-if="shape === Shape.Circle">
|
||||||
v-if="canAccept"
|
<circle
|
||||||
:r="size + 8"
|
v-if="canAccept"
|
||||||
:fill="backgroundColor"
|
:r="size + 8"
|
||||||
:stroke="receivingNode ? '#0F0' : '#0F03'"
|
:fill="backgroundColor"
|
||||||
:stroke-width="2"
|
:stroke="receivingNode ? '#0F0' : '#0F03'"
|
||||||
/>
|
:stroke-width="2"
|
||||||
|
/>
|
||||||
|
|
||||||
<circle :r="size" :fill="fillColor" :stroke="outlineColor" :stroke-width="4" />
|
<circle :r="size" :fill="fillColor" :stroke="outlineColor" :stroke-width="4" />
|
||||||
|
|
||||||
<circle
|
<circle
|
||||||
v-if="progressDisplay === ProgressDisplay.Fill"
|
v-if="progressDisplay === ProgressDisplay.Fill"
|
||||||
:r="Math.max(size * progress - 2, 0)"
|
:r="Math.max(size * progress - 2, 0)"
|
||||||
:fill="progressColor"
|
:fill="progressColor"
|
||||||
/>
|
/>
|
||||||
<circle
|
<circle
|
||||||
v-else
|
v-else
|
||||||
:r="size + 4.5"
|
:r="size + 4.5"
|
||||||
class="progressRing"
|
class="progressRing"
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
:stroke-dasharray="(size + 4.5) * 2 * Math.PI"
|
:stroke-dasharray="(size + 4.5) * 2 * Math.PI"
|
||||||
:stroke-width="5"
|
:stroke-width="5"
|
||||||
:stroke-dashoffset="
|
:stroke-dashoffset="
|
||||||
(size + 4.5) * 2 * Math.PI - progress * (size + 4.5) * 2 * Math.PI
|
(size + 4.5) * 2 * Math.PI - progress * (size + 4.5) * 2 * Math.PI
|
||||||
"
|
"
|
||||||
:stroke="progressColor"
|
:stroke="progressColor"
|
||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
<g
|
<g v-else-if="shape === Shape.Diamond" transform="rotate(45, 0, 0)">
|
||||||
v-else-if="shape === Shape.Diamond"
|
<rect
|
||||||
transform="rotate(45, 0, 0)"
|
v-if="canAccept"
|
||||||
@mouseenter="mouseEnter"
|
:width="size * sqrtTwo + 16"
|
||||||
@mouseleave="mouseLeave"
|
:height="size * sqrtTwo + 16"
|
||||||
@mousedown="mouseDown"
|
:transform="
|
||||||
@touchstart="mouseDown"
|
`translate(${-(size * sqrtTwo + 16) / 2}, ${-(size * sqrtTwo + 16) /
|
||||||
@mouseup="mouseUp"
|
2})`
|
||||||
@touchend="mouseUp"
|
"
|
||||||
>
|
:fill="backgroundColor"
|
||||||
<rect
|
:stroke="receivingNode ? '#0F0' : '#0F03'"
|
||||||
v-if="canAccept"
|
:stroke-width="2"
|
||||||
:width="size * sqrtTwo + 16"
|
/>
|
||||||
:height="size * sqrtTwo + 16"
|
|
||||||
:transform="
|
|
||||||
`translate(${-(size * sqrtTwo + 16) / 2}, ${-(size * sqrtTwo + 16) / 2})`
|
|
||||||
"
|
|
||||||
:fill="backgroundColor"
|
|
||||||
:stroke="receivingNode ? '#0F0' : '#0F03'"
|
|
||||||
:stroke-width="2"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<rect
|
<rect
|
||||||
:width="size * sqrtTwo"
|
:width="size * sqrtTwo"
|
||||||
:height="size * sqrtTwo"
|
:height="size * sqrtTwo"
|
||||||
:transform="`translate(${(-size * sqrtTwo) / 2}, ${(-size * sqrtTwo) / 2})`"
|
:transform="`translate(${(-size * sqrtTwo) / 2}, ${(-size * sqrtTwo) / 2})`"
|
||||||
:fill="fillColor"
|
:fill="fillColor"
|
||||||
:stroke="outlineColor"
|
:stroke="outlineColor"
|
||||||
:stroke-width="4"
|
:stroke-width="4"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<rect
|
<rect
|
||||||
v-if="progressDisplay === ProgressDisplay.Fill"
|
v-if="progressDisplay === ProgressDisplay.Fill"
|
||||||
:width="Math.max(size * sqrtTwo * progress - 2, 0)"
|
:width="Math.max(size * sqrtTwo * progress - 2, 0)"
|
||||||
:height="Math.max(size * sqrtTwo * progress - 2, 0)"
|
:height="Math.max(size * sqrtTwo * progress - 2, 0)"
|
||||||
:transform="
|
:transform="
|
||||||
`translate(${-Math.max(size * sqrtTwo * progress - 2, 0) / 2}, ${-Math.max(
|
`translate(${-Math.max(size * sqrtTwo * progress - 2, 0) /
|
||||||
size * sqrtTwo * progress - 2,
|
2}, ${-Math.max(size * sqrtTwo * progress - 2, 0) / 2})`
|
||||||
0
|
"
|
||||||
) / 2})`
|
:fill="progressColor"
|
||||||
"
|
/>
|
||||||
:fill="progressColor"
|
<rect
|
||||||
/>
|
v-else
|
||||||
<rect
|
:width="size * sqrtTwo + 9"
|
||||||
v-else
|
:height="size * sqrtTwo + 9"
|
||||||
:width="size * sqrtTwo + 9"
|
:transform="
|
||||||
:height="size * sqrtTwo + 9"
|
`translate(${-(size * sqrtTwo + 9) / 2}, ${-(size * sqrtTwo + 9) / 2})`
|
||||||
:transform="`translate(${-(size * sqrtTwo + 9) / 2}, ${-(size * sqrtTwo + 9) / 2})`"
|
"
|
||||||
fill="transparent"
|
fill="transparent"
|
||||||
:stroke-dasharray="(size * sqrtTwo + 9) * 4"
|
:stroke-dasharray="(size * sqrtTwo + 9) * 4"
|
||||||
:stroke-width="5"
|
:stroke-width="5"
|
||||||
:stroke-dashoffset="(size * sqrtTwo + 9) * 4 - progress * (size * sqrtTwo + 9) * 4"
|
:stroke-dashoffset="
|
||||||
:stroke="progressColor"
|
(size * sqrtTwo + 9) * 4 - progress * (size * sqrtTwo + 9) * 4
|
||||||
/>
|
"
|
||||||
</g>
|
:stroke="progressColor"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
|
||||||
<text :fill="titleColor" class="node-title">{{ title }}</text>
|
<text :fill="titleColor" class="node-title">{{ title }}</text>
|
||||||
|
</g>
|
||||||
|
</transition>
|
||||||
|
|
||||||
<transition name="fade" appear>
|
<transition name="fade" appear>
|
||||||
<text
|
<text
|
||||||
|
@ -389,6 +386,11 @@ export default defineComponent({
|
||||||
opacity: 0.25;
|
opacity: 0.25;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.grow-enter-from,
|
||||||
|
.fade-leave-to {
|
||||||
|
transform: scale(0);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
Loading…
Reference in a new issue