如何给角2/4中的动画状态赋予类名? [英] How to give class name to animation state in angular 2/4?

查看:70
本文介绍了如何给角2/4中的动画状态赋予类名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用4.1.3版的angular Animations

I am using angular Animations with version 4.1.3

下面是以下代码:

@Component({
  selector : 'my-fader',
  animations: [
    trigger('visibilityChanged', [
      state('true' , style({ opacity: 1, transform: 'scale(1.0)' })),
      state('false', style({ opacity: 0, transform: 'scale(0.0)'  })),
      transition('1 => 0', animate('300ms')),
      transition('0 => 1', animate('900ms'))
    ])
  ]
...

现在,而不是样式

Now, instead of style in state I would like to give existing class name i.e using the class defined in style sheets (i.e Not inline styles)

可以吗?如果可以,请帮忙。

Is that possible? If so please help.

推荐答案

您不能。我也在寻找类似的解决方案。

You can't. I was also looking for a similar solution.

Angular Animations使用Web动画API,而不使用CSS。

Angular Animations use the Web Animations API and not CSS.

请参见 https://css-tricks.com/css-animations-vs-web-animations-api/ 以便进一步阅读。

See https://css-tricks.com/css-animations-vs-web-animations-api/ for further reading.

这篇关于如何给角2/4中的动画状态赋予类名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆