A lightweight Svelte component to draw SVG on hover.
svelte
as dev dependencyhovering
for extra hover effects & conditionals--duration
to set the durationBlog post @hashnode: Build a Svelte Component To Draw SVG On Hover
npm install --save-dev svelte-hover-draw-svg
yarn add -D svelte-hover-draw-svg
pnpm add -D svelte-hover-draw-svg
SVG shape must have a stroke
<svg stroke="#000" stroke-width="2">
<path />
</svg>
This library works better with "Outlined" SVGs.
<script>
import HoverDrawSVG from 'svelte-hover-draw-svg';
</script>
<HoverDrawSVG>
<svg>
<path />
</svg>
</HoverDrawSVG>
<script>
import HoverDrawSVG from 'svelte-hover-draw-svg';
</script>
<HoverDrawSVG --duration="2">
<SvgComponent />
</HoverDrawSVG>
hovering
status):<script>
import HoverDrawSVG from 'svelte-hover-draw-svg';
</script>
<HoverDrawSVG let:hovering>
<a href="/" class:hoverEffect={hovering}>
<svg>
<path />
</svg>
</a>
</HoverDrawSVG>