我正在尝试使用补全功能对图像进行动画处理。动画工作正常,但未调用complete属性。我尝试环顾四周,但在发现我在做错的事情上没有发现任何结果。我在Chrome
和Firefox
上使用了下面的代码
document.getElementById("myImageId").animate([
{ transform: 'translateY(0px)' },
{ transform: 'translateY(-300px)' }
], {
duration: 300,
complete: function() { alert('end ani') }
});
[Element.animate()
返回一个Element.animate()
对象,并且您可以将Animation
的事件处理程序附加到该对象:
Animation
finish