2018. 5. 23. 18:21ㆍ프로그래밍/Jscript
SVG를 이용한 Timer 를 간단히 만들어 봄
시간은 10초
/// html
<svg class="progress-ring" width="39" height="39" style="position:relative;top:-4px;left:16px;"> <circle class="progress-ring__circle2" stroke="#e571fe" stroke-width="2" fill="transparent" r="8" cx="16" cy="16"/> </svg>
------------------------------------------------------------------------------------------------------------------------------------------------
///css
.progress-ring__circle2 {
transform: rotate(-90deg);
transform-origin: 50% 50%;
stroke-dashoffset: 0%;
stroke-dasharray: 51;
animation: dash2 10s linear infinite;
}
@keyframes dash2 {
from {
stroke-dashoffset: 51
}
to {
stroke-dashoffset: 0;
}
}
39 / 39 사이즈의 동그란 원이 시계방향으로 채워지는 형식임
여기서 중요한 포인트는 stroke-dashoffset 의 역할과 stroke-dasharray 역할을 알아야 한다는 것이다.
실제 점선으로 채워지고 없어지고.
나중에 다시 참고해서 stroke-dashoffset 과 stroke-dasharray 더 깊게 알아봐야 함
'프로그래밍 > Jscript' 카테고리의 다른 글
shallow Copy 와 Deep Copy 의 위험성 Object.assign (0) | 2018.08.31 |
---|---|
addEventListener에 Function 이름을 parameter로 호출하기 (0) | 2017.10.23 |
Javascript Animation 관련 (0) | 2017.07.26 |
DRAG EVENT 관련 (0) | 2017.07.20 |
WINDOW DPI 에 대한 EVENT MOUSE POSITION 관련 (0) | 2017.07.20 |