Web Animation API supports keyframe animation, so you can go "from" and "to":
// Go from 0 to 300px
someElement.animate(
[
{ transform: 'translateY(0)' },
{ transform: 'translateY(300px)' }
], {
duration: 1000
});
Is there some way to go "to" without having to specify "from"? Something like:
// Go from the current position to 300px
someElement.animate({ transform: 'translateY(300px)' }, {
duration: 1000
});
Or I must store the current position somewhere else?