javascript - angular 4 simultaneous animations -
i'm trying port webapp angularjs angular 4, , i'm having issues animations. "google images" type of view, have 2 animations need happen simultaneously when item clicked; 1 div needs margin-bottom increase, , child of div needs gradually appear, using ngif , transition on height. both animations work separately, if put both animations on respective elements, first 1 works.
i've made minimal plunker demonstrate mean: https://plnkr.co/edit/27efz3h16icnh3qdzqby?p=preview
const animationtiming = '1s ease'; @component({ selector: 'my-app', animations: [ trigger('expand', [ state('expanded', style({"margin-bottom": '392px'})), state('collapsed', style({"margin-bottom": '0'})), transition('* => *', animate(animationtiming)) ]), trigger('visibility', [ transition( ':enter', [ style({'height': '0'}), animate(animationtiming, style({'height': '*'})) ] ), transition( ':leave', [ style({'height': '*'}), animate(animationtiming, style({'height': '0'})) ] ) ]) ] template: ` <button (click)="toggle()">click</button><br/> <div class="container" [@expand]="expanded?'expanded':'collapsed'"> here <div class="detail" [@visibility] *ngif="expanded">something else in here</div> </div> <div class="container">something else</div> `, }) export class app { expanded: boolean = false; toggle() { this.expanded = !this.expanded; } } if click button, should happen new content expands in between "something here" , "something else". happens 2 frames move away each other expected, new content pops immediately. if remove [@expand] animation first div, new content gradually grow out of nothing 2 container divs don't make room it.
is there trick make these animations work simultaneously?
Comments
Post a Comment