Пример проблемы:
Код: Выделить всё
const first = document.getElementById("first");
const second = document.getElementById("second");
function animateit() {
first.classList.add("animated");
setTimeout(() => second.classList.add('animated'), 500)
}
function reset() {
first.classList.remove('animated');
second.classList.remove('animated');
}Код: Выделить всё
* {
margin: 5px;
}
div {
width: 50px;
height: 50px;
background: black;
}
#first {
transition: 1s cubic-bezier(0.5, 0, 0.5, 1);
}
#second {
transition: 0.5s cubic-bezier(0, 0, 0.5, 1);
transform: translateX(100px);
}
.animated {
transform: translateX(200px) !important;
}Код: Выделить всё
animate
reset
Я попробовал изменить замедление второго элемента и получил очень близко подошло к cubic-bezier(0.3, 0.6, 0.5, 1), но оно все равно не полностью совпадает.
Подробнее здесь: https://stackoverflow.com/questions/786 ... h-ease-out
Мобильная версия