简体   繁体   English

值变化时输入 Animation Angular 2+

[英]Input Animation when value changes Angular 2+

Hello im new with angular animations, i want to make my input animated when input value changes (is a calculator).您好,我是 angular 动画的新手,我想在输入值更改时使我的输入动画(是一个计算器)。 I have done this, how can shoot an event to execute the animation?我已经这样做了,如何拍摄一个事件来执行animation?

@Component({
    selector: 'xxxxx',
    templateUrl: './yyyy.html',
    styleUrls: ['./example.scss'],
    animations: [
        trigger('simpleFadeAnimation', [
            state('in', style({opacity: 1})),
            transition(':enter', [
                style({opacity: 0}),
                animate(600)
            ])
        ])
    ]
})

you can use wild cards你可以使用通配符

animations: [
        trigger('simpleFadeAnimation', [
            transition('*=>*', [
                style({opacity: 0}),
                animate(600)
            ])
        ])
    ]

So, you can use所以,你可以使用

<div [@simpleFadeAnimation]="value">
.....some...
</div>

Each time you change the variable "value", the animation begings每次更改变量“值”时,animation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM