I'm trying to do a kind of Homepage in Angular 4 with different cards like stats, charts etc using some animations. For the chart cards I made an icon button to toggle the div to make it bigger (fullscreen-like). The animation code currently works this way:
state('small', style({position: 'relative', width: '50%'})),
state('large', style({
transform: 'translateY(-150px)',
position: 'absolute',
width: '100%'
})),
transition('small => large', animate('600ms ease', keyframes([
style({position: 'absolute', width: '100%', offset: 0}),
style({transform: 'translateY(-150px)', offset: 1.0}),
]))),
transition('large => small', animate('600ms ease', keyframes([
style({transform: 'translateY(-150px)', offset: 0}),
style({width: '50%', right: 0, offset: 1.0}),
])))
This doesn't work as expected since for the first step (small => lage) the width is not animated, and for the reverse animation the translate is not either. I would like to do something "smoother" but I've been struggling for days to make it.
Here is a quick plunkr I made to show you what I did and the different things I tried (commented) (first plunkr don't judge me x)
Thanks for your help !