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
<script>
const options = ['rectangle', 'oval', 'circle', 'diamond']
let shape
let branches = 1
</script>

<div class="container">


<div>
<label>
Shape<br/>
<select bind:value={shape}>
{#each options as option}
<option>{option}</option>
{/each}
</select>
</label>

<label>
Branches<br/>
<input bind:value={branches} type="number"/>
</label>
</div>

<svg width=400 height=400 viewBox="0 0 100 100">
{#if branches % 2 == 1}
<line x1=50 y1=30 x2=50 y2=60/>
{/if}

{#if Number(branches) > 1}
{#each Array(Math.floor(branches/2)) as _, i}
<line x1=50 y1=30 x2=50 y2=60 style="transform: rotate(-{10 * (i+1)}deg); transform-origin: 50px 30px;"/>
{/each}

loading Svelte compiler...
/* Select a component to see its compiled code */
result = svelte.compile(source, {
generate: ,
});
/* Select a component to see its compiled code */