코드를 작성해보자
<linearGradient> 요소는 linear gradient를 표현한다.
x1, y1, x2, y2 속성 : 그라데이션의 방향을 지정
stop 요소 : 그라데이션에서 색상의 구간을 정의하는 역할
offset 속성 : 각각의 구간의 시작 위치를 나타냅니다.
style 속성 : 해당 구간의 색상을 정의합니다.
stroke=url(#grad)을 사용하여 에서 정의된 그라데이션을 할당한다.
<template>
<div class="round-chart">
<path xmlns="http://www.w3.org/2000/svg" d="M82,100A80,80,0,1,0,242,100A80,80,0,1,0,82,100Z" fill="transparent" stroke="url(#gradient)" stroke-width="20" />
<!-- 그라데이션 영역 -->
<defs>
<linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="red" />
<stop offset="100%" stop-color="yellow" />
</linearGradient>
</defs>
</svg>
</div>
</template>

'비전공자 검은콩의 몸으로 부딪히는 실무' 카테고리의 다른 글
| [CSS] min-content / max-content / fit-contents (0) | 2023.08.11 |
|---|---|
| [Vue3] Chart.js 툴팁 금지 (0) | 2023.08.09 |
| [Vue3] Button을 조건에 따라 클릭이 불가하게 만들자 (0) | 2023.08.09 |
| [Vue3] 클릭 시 데이터 가져오기, emit 사용법 (0) | 2023.08.09 |
| [Slick] 슬라이드 코드펜 autoplay (0) | 2023.08.07 |