【发布时间】:2017-11-21 12:02:13
【问题描述】:
我尝试制作一个看起来像“跑灯”的动画。
https://plnkr.co/edit/TiL6DLSLVYxLT63kBXfr?p=preview
正如您在我的 Plunker 中看到的那样,第一次运行看起来不错,但过了一会儿,灯光不同步了。 Obvioulsyanime.js 每次循环迭代都会再次添加延迟。我怎样才能防止这种情况发生?
$(document).ready(function() {
function animateText(container, el) {
$(container).each(function() {
var thisContainer = $(this);
var initialColor = $(this).find(el).css("color");
var delay = 0;
$(thisContainer).find(el).each(function() {
anime({
targets: $(this).get(0),
color: ["#ff0", initialColor],
duration: 1000,
loop: true,
delay: delay*50
});
delay++;
});
});
}
animateText('ul', 'li');
});
【问题讨论】:
-
这是另一个(不工作)尝试:plnkr.co/edit/zZgCBYbVJJoh6iwBq4IY?p=preview
标签: javascript animation anime.js