-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Animate MarkerView from current to another position #5242
Comments
I have been working on |
I'm now trying to solve some edge cases. One example of an edge case is panning a MarkerView out of bounds which will result in removing the MarkerView for caching purposes. This conflicts with doing an animation to a location that is visible on screen. Animating markers as a result should not be cached when we are animating them. |
One issue that is not solved with this use-case is animating the position of a ViewMarker that is found outside the map: While I feel this is a bug and should be solved. I'm not sure that current timings will allow fixing this. As a work around users could animate from a certain LatLng on the edge of Map. We should look into making MarkerView caching optional. |
Another issue is animating on map start when we receive the onMapReady callback + add a ViewMarker. When this occurs we need to wait for the ViewMarker to be added before executing any animations. Current workaround is: final MarkerView marker = mapboxMap.addMarker(new MarkerViewOptions().position(brussels));
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
marker.setPosition(utrecht, true);
}
}, 1000); |
We are looking at improving the performance of |
Since we are currently pointing on first approach that was already in place but fixed in ##5385 -> closing |
But I want to move multiple markers at a time. Like a Uber. How should I do that. Can you please help me with this? |
When we currently call
setPosition
onMarkerView
the position changes immediately. It would be nice to support a similar feature as withsetRotation
andsetAlpha
to perform an Android SDK animation when the position changes.Animating LatLng values
One approach for this is what we use in
AnimatedMarkerActivity
:While this works, it's not resulting in an smooth animation because the marker needs to go through jni for each update. I have been profiling the code the related code to make it run smooth but at this point, after doing a couple of improvements, I'm not sure if we will ever get the right UX.
Animating Pixel Coordinate values
Another approach is to use pixel coordinates instead of the
LatLng
coordinates above. This has the benefit that we don't need to pass through JNI to get the correct pixel coordinate value for each animation update but has the downside that we need to manage camera changes manually.The text was updated successfully, but these errors were encountered: