Skip to content

Commit

Permalink
docs(Arc): Simplify segment arc examples
Browse files Browse the repository at this point in the history
  • Loading branch information
techniq committed Jan 6, 2025
1 parent 53755f5 commit 93793d9
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions packages/layerchart/src/routes/docs/examples/Arc/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,9 @@
<SpringValue {value} let:value>
{#each { length: segments } as _, segmentIndex}
{@const segmentAngle = (2 * Math.PI) / segments}
{@const startAngle = segmentIndex * segmentAngle}
{@const endAngle = (segmentIndex + 1) * segmentAngle}
<Arc
{startAngle}
{endAngle}
startAngle={segmentIndex * segmentAngle}
endAngle={(segmentIndex + 1) * segmentAngle}
innerRadius={-20}
cornerRadius={4}
padAngle={0.02}
Expand All @@ -148,7 +146,7 @@
? 'fill-success-300'
: 'fill-surface-content/10'
)}
></Arc>
/>
{/each}

<Text
Expand Down Expand Up @@ -179,31 +177,23 @@
<SpringValue {value} let:value>
{#each { length: segments } as _, segmentIndex}
{@const segmentAngle = (2 * Math.PI) / segments}
{@const startAngle = segmentIndex * segmentAngle}
{@const endAngle = (segmentIndex + 1) * segmentAngle}
<Arc
{startAngle}
{endAngle}
startAngle={segmentIndex * segmentAngle}
endAngle={(segmentIndex + 1) * segmentAngle}
innerRadius={-20}
cornerRadius={4}
padAngle={0.02}
class={cls(
(segmentIndex / segments) * 100 < (value ?? 0)
? 'fill-success-300'
: 'fill-surface-content/10'
)}
></Arc>
/>
{/each}
</SpringValue>
</svelte:fragment>
<Arc
{value}
innerRadius={-20}
spring
let:value
class="fill-success-300"
track={{ class: 'fill-surface-content/10' }}
></Arc>
/>
</ClipPath>

<Text
Expand Down

0 comments on commit 93793d9

Please sign in to comment.