Thanks! Another fun challenge would be to add a timing function lerp, similar to cubic-bezier(x1, y1, x2, y2) to vary the speed over the course of the duration. It's a leap forward in complexity but quite doable.
We're a place where coders share, stay up-to-date and grow their careers.
With a couple extra parameters.
This will only work if the element is absolute positioned.
Have you tried el.style.transform = "translate(x,y)"
Nice! Although this will move the element from a given position, rather than where it is on the page.
Thanks! Another fun challenge would be to add a timing function lerp, similar to cubic-bezier(x1, y1, x2, y2) to vary the speed over the course of the duration. It's a leap forward in complexity but quite doable.