-
Notifications
You must be signed in to change notification settings - Fork 27k
Description
I'm submitting a ... (check one with "x")
feature request
Current behavior
Animation instructions doesn't accept bindings expression.
Expected/desired behavior
Animation metadata should allow instructions from the component instance.
Example:
@Component({
selector: 'my-app',
animations: [
trigger('fade', [
transition('void => in', [
animate('150ms linear', keyframes([
style('MY_STYLE'),
style({opacity: '*'})
]))
])
])
],
encapsulation: ViewEncapsulation.None,
template: `<div @fade="fadeState"></div>`})
export class FadeInBackdrop {
private fadeState: 'in' | 'out' = 'in';
MY_STYLE = {
opacity: 0
}
}What is the motivation / use case for changing the behavior?
This will allow dynamic animation based on user input.
Sine animation instructions are static the only way to change them in runtime is
A) Using auto style, letting the user set * from css
B) Define multiple states (not really dynamic)
This is really useful in 3rd part libraries where some sort of animation customization is needed.
Since the generated animation factory runs on every change it can get a hold of the instance and easily get the value.
The syntax for referencing a bind needs definition as style might be a string.