TAG
CSS
JavaScript
Result
Run
License
<div class="box"></div>
.box { width: 200px; height: 200px; border: 2px solid #CCC; border-radius: 20px; position: absolute; left: calc((100vw - 200px) / 2); top: calc((100vh - 200px) / 2); transition: transform 1s; }
window.addEventListener("load", () => { const elBox = document.querySelector(".box"); setTimeout(() => { elBox.style.transform = "scale(0.2)"; const animation = elBox.getAnimations({ subtree: true }); Promise.all(animation.map(ani => ani.finished)) .then(() => elBox.remove()); }, 500); });
Console
expand_less
License
License
by DevDic
Close