14 lines
368 B
JavaScript
14 lines
368 B
JavaScript
export class ProgressBar {
|
|
constructor() {
|
|
this.percentage = document.getElementById("progress-percentage");
|
|
this.indicator = document.getElementById("progress-indicator");
|
|
}
|
|
|
|
setProgress(progress) {
|
|
const percent = (progress * 100).toFixed(1) + "%";
|
|
|
|
this.percentage.innerText = percent;
|
|
this.indicator.style.clipPath = `rect(0 ${percent} 100% 0)`;
|
|
}
|
|
}
|