I use some animations on my angular2+ component. It works fine but i want to use some variables instead of the hardcoded values ('20px', '10px').
Is there a possibility to use some typescript-variables at animations?
For example:
@Component({
selector: 'animationDialog',
templateUrl: './animationDialog.component.html',
styleUrls: ['./modal.component.css'],
animations: [
trigger('dialog', [
state('enter', style({
transform: 'translate(this.TYPESCRIPTVAR1, this.TYPESCRIPTVAR2)',
top: 'this.TYPESCRIPTVAR3',
height: 'this.TYPESCRIPTVAR4'
})),
('leave', style({
transform: 'translate(this.TYPESCRIPTVAR1, this.TYPESCRIPTVAR2)',
top: 'this.TYPESCRIPTVAR3',
height: 'this.TYPESCRIPTVAR4'
}))
Current Code:
animations: [
trigger('dialog', [
state('enter', style({
transform: 'translate(0px, -80px)',
top: '200px',
height: '320px'
}))
I've already checked another question, but this issue only treats one variable style. In my case, i've a variable style on one property (e.g. "background-color"), but these property is variable on different states.
Thanks.