feat(animations): support styling of the default animation state

It is now possible to set a fallback state that will apply its
styling when the destination state is not detected.

```ts
state("*", style({ ... }))
```

Closes #9013
This commit is contained in:
Matias Niemelä
2016-06-03 17:52:33 -07:00
parent c3d2459a4e
commit 36d25f2a07
9 changed files with 121 additions and 11 deletions

View File

@ -17,7 +17,9 @@ import {
<div @backgroundAnimation="bgStatus">
<button (click)="state='start'">Start State</button>
<button (click)="state='active'">Active State</button>
|
<button (click)="state='void'">Void State</button>
<button (click)="state='default'">Unhandled (default) State</button>
<button style="float:right" (click)="bgStatus='blur'">Blur Page</button>
<hr />
<div *ngFor="let item of items" class="box" @boxAnimation="state">
@ -34,6 +36,7 @@ import {
])
]),
trigger("boxAnimation", [
state("*", style({ "height": "*", "background-color": "#dddddd", "color":"black" })),
state("void, hidden", style({ "height": 0, "opacity": 0 })),
state("start", style({ "background-color": "red", "height": "*" })),
state("active", style({ "background-color": "orange", "color": "white", "font-size":"100px" })),
@ -65,15 +68,15 @@ export class AnimateApp {
get state() { return this._state; }
set state(s) {
this._state = s;
if (s == 'start' || s == 'active') {
if (s == 'void') {
this.items = [];
} else {
this.items = [
1,2,3,4,5,
6,7,8,9,10,
11,12,13,14,15,
16,17,18,19,20
];
} else {
this.items = [];
}
}
}