I have a child component with animations
child.component.ts
@Component({
selector: 'child',
animations:[
// animations
]
})
export class ChildComponent { ... }
And a parent component, which has 2 of the child components in the html
parent.component.hmtl.ts
...
<child></child>
<child></child>
...
What I want to achieve is to stagger the animations of the child components in the parent component. Therefore second child component should start animation after X seconds.
animateChild() sounds like it might work but I cant figure out how I can use it. Is that the right solution? If so an example would be really helpful.
Thanks in advance
EDIT: animateChild() does not seem to work for this case. Appearantly it only works on animations that are defined in the parent component.
EDIT2: I think there might be a workaround by adding a delay to the animations inside of the child components.
child.component.ts
@Component({
selector: 'child',
animations:[
animate(x),
// animations
]
})
export class ChildComponent { ... }
The x would be a variable that would increase for every child component. This workaround looks kinda messy to me
EDIT3: the anwers so far are more or less the solution i mentioned in my second edit. While those do work I still consider those as workarounds.
I am looking for a solution that only involves the parent component therefore the child component should stay the way it is like in this non working example