Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Smooth animation in user tracking mode #3629

Closed
tobrun opened this issue Jan 20, 2016 · 11 comments · Fixed by #5155
Closed

Smooth animation in user tracking mode #3629

tobrun opened this issue Jan 20, 2016 · 11 comments · Fixed by #5155
Assignees
Labels
Android Mapbox Maps SDK for Android feature GL JS parity For feature parity with Mapbox GL JS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general

Comments

@tobrun
Copy link
Member

tobrun commented Jan 20, 2016

Currently on Android the UserLocationView animates from one location update to another.
You can clearly see the different location updates coming in and the it doesn't seem that the user is traveling at a constant speed. To properly support the idea of implementing navigation, we should streamline location updates/animation.

There are two ways to improve this user experience:

  • Entity interpolation
  • Dead reckoning

On iOS they have chosen to implement Entity interpolation which means that the user dot is actually one step behind the actual location, it is always trying to catch up.

@1ec5 @bleege @zugaldia

@tobrun tobrun added GL JS parity For feature parity with Mapbox GL JS Android Mapbox Maps SDK for Android feature request labels Jan 20, 2016
@tobrun tobrun added this to the android-v4.0.0 milestone Jan 20, 2016
@1ec5
Copy link
Contributor

1ec5 commented Jan 20, 2016

On iOS they have chosen to implement Entity interpolation

#3589 and #1582

@bleege
Copy link
Contributor

bleege commented Feb 8, 2016

This is going to be a very useful thing to have. @tobrun do you want to run at this after the dust settles a bit more after MapboxMap was introduced in #3145.

@tobrun tobrun modified the milestones: android-v4.1.0, android-v4.0.0 Mar 6, 2016
@bleege bleege modified the milestone: android-v4.1.0 Mar 18, 2016
@tobrun tobrun mentioned this issue Mar 21, 2016
12 tasks
@zugaldia zugaldia added the navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general label Mar 21, 2016
@tobrun tobrun added this to the android-v4.1.0 milestone Apr 13, 2016
@tobrun
Copy link
Member Author

tobrun commented Apr 25, 2016

The first iteration landed with #4695

The following items should be resolved to close this issue:

  • While in follow location mode, we are using the the easeTo animate the map under the user location view. The easeTo method uses an easing interpolator and this makes the animation a bit jumpy. Having a linear interpolator variant would resolve this.
  • While in non follow location mode. The user location view is animated with the Android animator framework. The animator framework is time based which makes an animation to have a start and end state. This currently results in a very jumpy animation at high zoom levels, we should probably look in alternative ways of doing this outside the animator framework or write a custom animator from scratch.

@1ec5
Copy link
Contributor

1ec5 commented Apr 25, 2016

The easeTo method uses an easing interpolator and this makes the animation a bit jumpy. Having a linear interpolator variant would resolve this.

You’ll want to set easing on easeTo()’s optional AnimationOptions parameter. See #3589 for more details.

@tobrun
Copy link
Member Author

tobrun commented Apr 26, 2016

@1ec5 thank you for the always helpfull comments 🙇

@tobrun
Copy link
Member Author

tobrun commented Apr 26, 2016

I have been looking into adding an own supplied UnitBezier as:

animationOptions.easing.emplace(mbgl::util::UnitBezier(0, 0, 1, 1));

Which matches the Linear interpolator found in the Apple docs.

After adding this it seems the easing interpolation is still there. You can see a clear difference in acceleration at start and deceleration at end. See this clip here.

@1ec5 any hints on what I'm doing wrong here?

@1ec5
Copy link
Contributor

1ec5 commented Apr 26, 2016

You should just be able to assign the UnitBezier to that field. But I’m not sure why it isn’t working for you regardless. That recording makes it look like the custom easing is being ignored.

@tobrun
Copy link
Member Author

tobrun commented May 26, 2016

Revisiting this and this time around I was able to remove interpolation. You can see this in action here. This video was taken on a high zoomlevel were easing used to be very visible.

FWIW a video at a lower zoomlevel.

@tobrun
Copy link
Member Author

tobrun commented May 26, 2016

I'm going to PR the smooth animation for tracking mode separately from the non-tracking. In code these are completely different things and I want to include 49aae67 in the next SNAPSHOT.

@tobrun
Copy link
Member Author

tobrun commented May 26, 2016

I was able to get the non-tracking to work as well:

ezgif com-video-to-gif 25
ezgif com-video-to-gif 24

@tobrun
Copy link
Member Author

tobrun commented May 26, 2016

With above in place, I'm going to cleanup the MyLocationView class a bit and PR it.

tobrun added a commit that referenced this issue May 26, 2016
…ser location, introducing a new easeTo method with a linear interpolator
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android feature GL JS parity For feature parity with Mapbox GL JS navigation For the Mapbox Navigation SDK for Android or iOS or navigation use cases in general
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants