如何使用 js 或 css 选择 animation-iteration-count 的值?下面是我的CSS。目的是第一次画黑色,第二次画。感谢您的帮助。
.path { animation: draw 8.5s linear ; } @keyframes draw { 0% {stroke: #000;} 25% {stroke:#000;} 50% {stroke: #000;} 75% {stroke: #000;} 100% {stroke: none;fill:#000;stroke-dashoffset:100; } }
最佳答案
我可以使用下面的 jQuery 函数。
function animate(count) {
console.log("animate", count)
if (count == 0) {
$('.path').css({
'animation': 'draw2 4s'
});
}
if (count == 1) {
$('.path').css({
'animation': 'draw1 4s'
});
}
if (count == 2) {
$('.path').css({
'animation': 'draw3 4s'
});
}
if (count > 0) $('.path:first').one("animationend", function () {
animate(count - 1)
})
}
关于javascript - 如何使用css或js选择animation-iteration-count的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51706984/