角度4动画-不应用过渡时间 [英] angular 4 animations - transition duration is not applied

查看:73
本文介绍了角度4动画-不应用过渡时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做什么错?过渡发生了,但是是即时的。动画功能中设置的时间未应用

what am I doing wrong? The transition happens but it's instant. The time set in animate function is not being applied

trigger('showMenu', [
  state('active', style({
    marginLeft: '0px'
  })),
  state('inactive', style({
    marginLeft: '-230px'
  })),
  transition('inactive => active', animate('2s')),
  transition('active => inactive', animate('2s'))
])

<div [@showMenu]="showMenuState" id="menu-side-wrapper">
    MENU
    <div id="close-menu">
       CLOSE
    </div>
</div>


推荐答案

我已经检查了粘贴在此处的代码而且效果很好。您可以添加其他任何相关代码吗?也许是 showMenuState的代码?

I've checked the code you've pasted here and it works fine. Could you add any other relevant code? Maybe the code for 'showMenuState'?

这篇关于角度4动画-不应用过渡时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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