
@keyframes ball-ani {
from {
transform: translate(0, 0);
}
to {
transform: translate(200px, 200px);
}
}
ballElm.addEventListener('click', function () {
ballElm.style.animation = `ball-ani 1s 3 alternate forwards`;
});
ballElm.addEventListener('animationend', function () {
ballElm.classList.add('end');
});
μ λλ©μ΄μ μ΄ λ°λ³΅λλ μμ μ μ‘μλΌ μλ μμ
μ¬μ μΌμ λλ. νμ λλ μμ‘νκ³ λ°λ³΅ countλ§ ν¨
// λΆλͺ
3λ² λ°λ³΅μΈλ° 2λ² μ°νλ μ΄μ μ
animation: ball-ani 1s 3 alternate forwards;
ballElm.addEventListener('animationiteration', function () {
console.log('λ°λ³΅!');
});

