0
私はアニメーションを作るためにクリックすると、私は二つの状態と二つの状態アニメーションが即座に
間の遷移でトリガを作成し、私は3000ms遷移時間を入力すると、それは状態
<div class="divv" [@goals]='stateExression'>
<mat-card class="example-card">
<mat-card-header>
<div mat-card-avatar class="example-header-image"></div>
<mat-card-title>Shiba Inu</mat-card-title>
<mat-card-subtitle>Dog Breed</mat-card-subtitle>
</mat-card-header>
<img mat-card-image src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
<mat-card-content>
<p>
Hello
</p>
</mat-card-content>
<mat-card-actions>
<button mat-button (click)="anim()">LIKE</button>
<button mat-button>SHARE</button>
</mat-card-actions>
</mat-card>
</div>
でも即座に実行されます動作しますチェンジ機能:
stateExression : string='inactive';
anim() {
if(this.stateExression === 'inactive')
this.stateExression ='expended';
else
this.stateExression = 'inactive';
}
アニメーショントリガー:
trigger('goals', [
state('inactive', style({
height: '300px'
})),
state('expended', style({
height: '0px'
})),
transition ('inactive <=> expanded',animate('2000ms'))
])
]
移行をゆっくり実行するには?
対異なる
expanded
ているあなたはすべてのエラーを取得していますか? – SONGSTER私はときどきタイプミスを見つけるのは難しいですが、文字列のタイプミスでスタックオーバーローに質問を作成するのはちょっとです。typescriptの新しいバージョンを使用すると、このような状況を避けるためにString Enumsを推奨するか、 – DrNio
いいえ、ありがとうございました –