You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Animate MarkerView from current to another position #5242
When we currently call setPosition on MarkerView the position changes immediately. It would be nice to support a similar feature as with setRotation and setAlpha 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.
I have been working on Animating Pixel Coordinate values today and was able to get a rough version of it in place. I'm going to revisit this implementation tomorrow and see if it fulfils the use-case we envision it to do.
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:
Activity
tobrun commentedon Jun 14, 2016
I have been working on
Animating Pixel Coordinate valuestoday and was able to get a rough version of it in place. I'm going to revisit this implementation tomorrow and see if it fulfils the use-case we envision it to do.tobrun commentedon Jun 16, 2016
This is the
Animating Pixel coordinateexample:The most difficult to this approach is restoring the animation after the map changes:
tobrun commentedon Jun 16, 2016
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.
tobrun commentedon Jun 16, 2016
Views that aren't been animated will not be cached by the system.
This resolves this issue mentioned above.
tobrun commentedon Jun 16, 2016
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.
tobrun commentedon Jun 16, 2016
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:
tobrun commentedon Jun 17, 2016
We are looking at improving the performance of
mbgl::updatePointAnnotationin #5385.tobrun commentedon Jun 17, 2016
Since we are currently pointing on first approach that was already in place but fixed in ##5385 -> closing
Yogesh9900 commentedon Jun 11, 2019
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?