【发布时间】:2019-12-23 12:17:30
【问题描述】:
基本上我在单击导航按钮时触发了“animejs”动画,然后在第二次单击后相同的动画会反转。它会切换。现在更新animejs后这不再有效。
我尝试过使用变量,例如 var 播放 = 真;并在它之间切换,但它不具备与以前相同的功能。
代码看起来像这样(这是简化的)
var navAnimation = anime.timeline({
duration: 100,
});
animation.add({
targets: 'navStuff'
//animation would be here
});
document.querySelector('.nav').onclick = () => {
animation.play();
// animation.play still functions properly
animation.reverse();
// animation.reverse(); is broken
};
//before the update you could simply place a two methods within the onclick function and it would toggle between them but that no longer is the case with animejs
我想要发生的是能够使用单个目标(按钮)来打开我的导航并关闭它(在两种状态之间切换)。我希望能够向按钮发送垃圾邮件,而不是看到和出现故障(和以前一样)。
【问题讨论】:
标签: javascript reactjs user-interface animation anime.js