I want to rotate an image based on a value from a slider using Angular animation. I can get the animation triggered using value change notifier :increment & :decrement. But can't use the latest value in the css properties in animate style block.
My code so far looks like this-
for binding in template-
<mat-slider [(ngModel)]="rotationAngle" ...>
<img [@photoState]="rotationAngle" src="...">
in component class declaration-
rotationAngle: number = 0;
constructor() { }
ngOnInit() {
this.rotationAngle = 0;
}
get stateName() {
return this.rotationAngle;
}
now in @Component block-
animations: [
trigger('photoState',
[
transition(':increment, :decrement', [
style('*'),
animate('500ms', style({transform: 'rotate({{ rotationAngle }}deg)'}))
],{
params: {
rotationAngle: ... /* need to use the slider value here, I assume. Any other way? */
}
})
])
]
Is there any way to do this? Should I try some other approach like AnimationBuilder (maybe) ?