I'm writing a custom progress bar using gradients and color stops.
See example: https://stackblitz.com/edit/angular-progress-bar-gradient
The problem I'm trying to fix is the animation is very "jumpy". I want to animate the progress bar so it fills smooth and gradually instead of instantly jumping to the new position.
I tried adding transition: all 0.4s ease-in; to my button but that does not seem to effect the gradient at all.
Component.ts
import { Component, VERSION } from "@angular/core";
@Component({
  selector: "my-app",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {
  name = "Angular " + VERSION.major;
  progressStyle = "#18191C";
  constructor() {
    const me = this;
    let perc = 0;
    setInterval(() => {
      me.progressStyle = `linear-gradient(90deg, #8354C1 ${perc}%, #18191C ${perc}%)`;
      perc += 5;
      if (perc >= 100) {
        perc = 0;
      }
    }, 300);
  }
}
Component.html
<button type="button" class="btn btn-secondary launch-btn" [style.background]="progressStyle">
  Testing
</button>
Component.css
.btn {
  height: 50px;
  box-shadow: none;
}
.btn[disabled] {
  cursor: default;
}
.btn.launch-btn {
  border: none;
  transition: all 0.4s ease-in;
  width: 500px;
}
 
    