I am making an application where I need a object to move from point a to point b starting out fast but then slowing down. I want to do this with pure vanilla js and no libraries whatsoever. This is my current code for animating something at a constant speed and I was wondering if it was possible to modify it or something.
let player = document.querySelector('.player');
var id = setInterval(frame, 1);
let counter = 0;
function frame() {
if (counter == 50) {
clearInterval(id);
counter = 0;
return;
} else {
player.style.top = player.offsetTop - 2 + 'px';
counter++
}
}