Gerard Sans
Aug 23, 2017 · 1 min read

Thanks Alex! Much appreciated. That’s not going to work. To achieve dynamic animations, as in during runtime, you need to use AnimationBuilder. Check this Plunker for a quick and dirty example (About page).

animateTo(to: number) {
const loaderAnimation = this.builder.build([
animate('350ms cubic-bezier(.35, 0, .25, 1)',
style({ width: '{{to}}%' }))
]);
return loaderAnimation
.create(this.loadingBar.nativeElement, {params: { to }});
}

https://plnkr.co/edit/7ME6xRtsrsiBEAJUD2iw?p=preview

)

    Gerard Sans

    Written by

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade