Sliding/Moving effect when changing marker's position

Hi Team, I want to have a sliding/moving effect on marker when changing its position from A to B. Currently i am using marker.setLngLat([long.lat]) to change the marker position, but it does give that sliding effect. Is there any way to achieve this requirement.

There is no builtin method that is moving the marker.
That doesn’t sound like a common use case.

I wanted to track vehicle position on map and to show vehicle is moving, i wanted to give sliding effect on marker whenever i was receiving new position from vehicle. I saw google map provides sliding marker (https://github.com/terikon/marker-animate-unobtrusive), so thought in totmtom too there would be something like that.

Hi!

As @maloleps we do not provide ready to use animation features, but it should be fairly easy to implement it by using requestAnimationFrame method together with marker.setLngLat(...).

Regards,
Mateusz

Thanks for your suggestion. I got it working using `requestAnimationFrame’ .

1 Like