[英]How to create circle svg progress bar with dashed border
嘗試對您提到的教程進行以下更改:
progress.component.css:
~~~~~~~~~~~~~~~~~~~~~~~
.progress__meter {
stroke: #4CAF50;
}
.progress__value {
stroke: white;
transition: all 100ms;
}
progres.component.html:
~~~~~~~~~~~~~~~~~~~~~~~
<div class="progress">
<svg class="progress__svg" width="120" height="120" viewBox="0 0 120 120">
<circle class="progress__meter" [style.strokeDasharray]="5" cx="60" cy="60" [attr.r]="radius" stroke-width="11" />
<circle class="progress__value" [style.strokeDasharray]="circumference" [style.strokeDashoffset]="1-dashoffset" cx="60" cy="60" [attr.r]="radius" stroke-width="12" />
</svg>
<div class="progress__value-text">{{value}}%</div>
</div>
progress.component.ts:
~~~~~~~~~~~~~~~~~~~~~~
private progress(value: number) {
const progress = value / 100;
this.dashoffset = this.circumference * (progress);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.