Код: Выделить всё
boxКод: Выделить всё
Код: Выделить всё
.anim {
animation-name: anim;
animation-duration: 4s;
animation-timing-function: linear; /* cubic-bezier(0.1, -0.6, 0.2, 0); */
}
@keyframes anim {
0% { left: var(--xs); }
100% { left: var(--xe); }
}
Код: Выделить всё
var box = document.getElementById('box');
box.style.setProperty('--xs', '0px');
box.style.setProperty('--xe', '200px');
box.classList.add('anim');
Код: Выделить всё
setTimeout(() => {
box.style.setProperty('--xe', '400px');
},1000)
Вот JSFiddle: https://jsfiddle.net/Imabot/53hLe2zq/
Подробнее здесь: https://stackoverflow.com/questions/758 ... parameters
Мобильная версия