I'm trying to find a way to control CSS3/ angular 2 animations.
For example, look at the following code from the offical angular 2 animation docs with some changes:
animations: [
trigger('flyInOut', [
state('in', style({position: 'absolute', left: '15%',bottom:'15%'})),
transition('void => *', [
animate(300, keyframes([
style({opacity: 0, left: '30%', offset: 0}),
style({opacity: 1, left: '50%', offset: 0.3}),
style({opacity: 1, left:'80%', offset: 1.0})
]))
])
])
]
My question is that if there is any way to control the css values with angular 2 variables. An illustration would be:
<animation leftPrec="15%" bottomPrec="15%" firstStep="30%" secondStep="60%" thirdStep="80%"></animation>
and in the animation component:
animations: [
trigger('flyInOut', [
state('in', style({position: 'absolute', left: leftPrec,bottom:bottomPrec})),
transition('void => *', [
animate(300, keyframes([
style({opacity: 0, left: firstStep, offset: 0}),
style({opacity: 1, left: secondStep, offset: 0.3}),
style({opacity: 1, left: thirdStep, offset: 1.0})
]))
])
])
]
This demo obviously not working and written for illustration for what i'm trying to achieve.
I would love to hear if you have any way or suggestion about how to achieve something similar in order to control the animation keyframes properties.