JSFiddle - React, Tailwind, and code Playground
HTML
<div class="round"></div>
<div class="base">
<div class="box"></div>
</div>
<button>ONE MORE</button>
CSS
@keyframes inhale {
from {
opacity: 1;
transform-origin: 50% 50%;
transform: scale(1) translate(0%, 0%);
}
to {
opacity: 0;
transform-origin: 96% 70%;
transform: scale(0) translate(70%, 70%);
}
}
.box {
position: absolute;
width: 90%;
height: 90%;
background: rgb(60, 0, 170);
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
}
.inhale {
animation: inhale 1s cubic-bezier(0, 1, .56, 1);
}
.base {
width: 100%;
height: 100vh;
background: rgb(32, 38, 46);
}
.round {
position: absolute;
bottom: 10px;
right: 10px;
width: 200px;
height: 200px;
border-radius: 50%;
background: rgb(0, 176, 230);
}
button {
position: absolute;
left: 0;
top: 0;
margin: 10px;
}
JavaScript
$(function() {
$("button").on('click', function() {
$(".box").addClass('inhale').on('animationend', function() {
$(this).removeClass('inhale');
});
});
});