Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
shape.js
<script>
import { inner } from './shape.js';
import { fade } from 'svelte/transition';
const innerArr = inner.split(',');
let scrollY;
let svgString = '';
$: {
svgString = '';
for (let i = 0; i < scrollY; i++) {
if(i < innerArr.length) svgString = svgString + innerArr[i] + ',';
}
}
</script>

<svelte:window bind:scrollY/>
<div class="container">
<svg width="300" height="300" viewbox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<path transition:fade
stroke="green" fill="black"
d={svgString}
/>
</svg>
</div>


<style>
:global(body){
height: calc(5*100vh);
overflow-x: hidden;
}
.container {
position: fixed;
top: 10%;
left: 50%;
loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */