<s>[INST] function update() {
    var element = document.getElementById("myElement");
    // ... some code ...
    element.style.top = element.offsetTop - 10 + "px";
}

setInterval(update, 100);
That code is fine but it will make myElement slide up at a constant speed. In order to create a smooth animation, I would like to gradually slow down the speed of myElement's movement over time. To do that, I need to slow down the movement of myElement on each iteration of update(). I can do this by adding less to the offsetTop value on each iteration, but how can I keep track of the speed of myElement's movement so I can adjust it on each iteration?[/INST]