I am currently developing a page using Angular that includes multiple progress bars indicating the progress made for actions that have specific durations. My goal is to utilize the Angular Material progress bar to create a seamless animation from start time to end time. I have implemented a method where I update the percentage of completion every 50ms and assign this value to the progress bar, as demonstrated in the code snippet below:
const start = new Date().getTime();
const source = timer(0, 50);
const subscribe = source.subscribe(() => {
const time = new Date().getTime();
if (time - start > length) {
subscribe.unsubscribe();
}
this.progressValue = 100 * (time - start) / length;
});
Here is the HTML code for the progress bar itself:
<mat-progress-bar mode="determinant" [value]="progressValue"></mat-progress-bar>
However, the progression of the progress bar appears choppy. Are there any alternative methods to achieve a smoother transition? Since the duration of the process is known each time, I believe achieving a smooth progression for that specified time should be straightforward. Thank you!