JSFiddle - React, Tailwind, and code Playground
HTML
<button>Like</button>
SCSS
button{
display: block;
position: absolute;
left: 50%;
bottom: 50%;
color: transparent;
width: 30px;
height: 30px;
border: none;
background: red;
cursor: pointer;
clip-path: path("M12 4.248c-3.148-5.402-12-3.825-12 2.944 0 4.661 5.571 9.427 12 15.808 6.43-6.381 12-11.147 12-15.808 0-6.792-8.875-8.306-12-2.944z");
}
JavaScript
let btn = document.querySelector('button');
btn.addEventListener('click', () => {
fly(2000)
});
function fly(time) {
let clone = btn.cloneNode(true);
document.body.appendChild(clone);
let start = Date.now();
let timer = setInterval(function() {
let timePassed = Date.now() - start;
if (timePassed >= time) {
clearInterval(timer);
clone.remove();
return;
}
let offset = -(timePassed / 10) + 'px';
clone.style.transform = "translateY(" + offset + ")";
}, 20);
}