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

Concurrent transition animations #3625

Open

Description

@1ec5

mbgl::Transform only supports one transition animation at a time, and starting an animation ends any existing animation (see #3624). mbgl::Transform should be refactored to manage multiple concurrent animations, potentially with staggered start and end times. At a minimum, it should be possible for two animations that animate different properties to run without conflicting with one another.

/cc @ansis @lucaswoj

Activity

  1. jfirebaugh commented on Jan 20, 2016

    @jfirebaugh
    Contributor

    Can you say more about why it needs to support this?

  2. 1ec5 commented on Jan 20, 2016

    @1ec5
    ContributorAuthor

    On iOS, in heading tracking mode, user location updates typically come in every second or so (less frequently when there’s poor GPS connectivity), while heading updates come in more or less in real time from the on-board magnetometer.

    MGLMapView pans to the new location with animation and also independently rotates to the new heading with animation. However, if you’re in motion and aren’t keeping your device pointed in a constant direction, heading updates tend to interrupt animations to new locations. On master, this is perceived as the map jumping from location to location with smooth rotation. In #3589, this is perceived as a series of smooth rotations in one place, followed by rapid panning as the location updates catch up.

    I considered less drastic approaches to addressing this issue, such as allowing callers to easeTo() to update the camera in the middle of the animation, but the resulting code was messier than what we would get by supporting multiple concurrent animations. To be clear, all the animations would continue to run on the Map thread, but we’d interleave their frame functions rather than canceling animations.

  3. ansis commented on Jan 20, 2016

    @ansis
    Contributor

    to update the camera in the middle of the animation

    What does "update the camera" mean here? If I do map.getLatLng in the middle of an animation do I get the current location or the location of the beginning of the animation?

  4. 1ec5 commented on Jan 20, 2016

    @1ec5
    ContributorAuthor

    What does "update the camera" mean here?

    CameraOptions is passed in by reference, so I considered checking on each frame whether the CameraOptions fields had changed and adjust accordingly. But that would never yield a pleasing animation and introduces too much complexity into what are already complex easeTo() and flyTo() methods. I don’t see a whole lot of code in mbgl or the iOS or OS X SDKs that assumes only one animation can run at a time. The Android SDK does appear to rely on this assumption for its listeners (cc @tobrun), so there might need to be more significant changes there.

    If I do map.getLatLng in the middle of an animation do I get the current location or the location of the beginning of the animation?

    You get the current location. That won’t change.

  5. 1ec5 commented on Jul 8, 2016

    @1ec5
    ContributorAuthor

    A completely different approach to this problem would be to have platform-specific SDK code drive the animation. iOS, macOS, and Qt (not sure about Android) all have rich animation APIs, with options for keyframe animation, spring animations, and physics modeling, all things we wouldn’t want to have to build in mbgl and expose as a somewhat foreign-looking API. Animation notifications also become more predictable because only one layer of the stack is involved.

    However, perhaps mbgl::Transition is valuable in its own right as an analogue to GL JS’s animation options. In that case, we’ll want to implement the concurrent animations described above for parity with mapbox/mapbox-gl-js#2801.

    /cc @tmpsantos

  6. added
    navigation
    on Feb 22, 2017
  7. 1ec5 commented on Feb 22, 2017

    @1ec5
    ContributorAuthor

    It may be unnecessary for us to implement this feature at the mbgl level if we end up driving camera transitions at the SDK level on Android (#8175) and iOS/macOS (#8176) like we do in Qt.

  8. added
    Core
    on May 30, 2017
  9. 1ec5 commented on Mar 27, 2018

    @1ec5
    ContributorAuthor

    In #3589, this is perceived as a series of smooth rotations in one place, followed by rapid panning as the location updates catch up.

    #10906 describes this behavior as well.

  10. stale commented on Oct 25, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  11. added
    archived
    on Oct 25, 2018
  12. removed
    archived
    on Oct 25, 2018
  13. juliengdt commented on Apr 16, 2019

    @juliengdt

    Hello everyone.
    I encountered this issue in my app (indoor location with heading)

    This is really annoying, especially with a minimal zoom on the user position (many animation when I walk + many animation for heading)

    Any workaround for this ?

  14. juliengdt commented on May 16, 2019

    @juliengdt

    Ahoy, I up it ! Any announcements or any good workaround ?

    thanks anyway

  15. added
    archived
    on Nov 12, 2019
  16. stale commented on Nov 12, 2019

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

  17. 1ec5 commented on Apr 13, 2020

    @1ec5
    ContributorAuthor

    This is still a need, particularly so that heading tracking isn’t mutually exclusive of location tracking: #3625 (comment).

  18. reopened this on Apr 13, 2020
  19. removed
    archived
    on Apr 13, 2020
  20. added
    archived
    on Oct 11, 2020
  21. stale commented on Oct 12, 2020

    @stale

    This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

  22. reopened this on Dec 10, 2020
  23. removed
    archived
    on Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Corefeaturenavigation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions