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.

Reimplement camera transitions with Core Animation #8176

Closed

Description

@1ec5

The iOS and macOS SDKs should use indirect property animation in Core Animation to drive camera transitions in response to gestures and calls to methods like -setCamera:animated: and -flyToCamera:…. We should move off mbgl::AnimationOptions and use the mbgl::Transform methods only for incremental transform changes on each frame of the animation.

A key benefit is that the Android SDK will be able to implement concurrent animations (#3625) without us having to design an API around tweening, spring solving, or the like. There are already mature APIs for these effects in UIKit Dynamics.

#8175 is the equivalent issue on Android. Perhaps there’s also prior art in the Qt SDK, where we’ve always relied on Qt animation APIs instead of mbgl’s.

/cc @incanus @bsudekum @frederoni @boundsj

Activity

  1. added
    iOS
    macOS
    navigation
    on Feb 22, 2017
  2. 1ec5 commented on Feb 22, 2017

    @1ec5
    ContributorAuthor

    The only nontrivial animation type mbgl supports is flight animation. We could factor out a utility that calculates the trajectory given a few inputs that we can use on both iOS/macOS and Android.

  3. brunoabinader commented on Mar 6, 2017

    @brunoabinader
    Contributor

    @1ec5 are you thinking towards a core utility API for this? This way even e.g. Qt could take advantage of.

  4. 1ec5 commented on Mar 6, 2017

    @1ec5
    ContributorAuthor

    Yes, I was envisioning a core utility API, perhaps a standalone API like Projection, that calculates flight trajectories. That would make it easily usable by the iOS, macOS, and Qt SDKs. Unfortunately, it occurs to me that it probably wouldn’t be usable by the Android SDK. That code would have to run on every frame of the animation, and my understanding is that we want to minimize the amount of JNI-crossing that occurs during animation. Fortunately, the algorithm behind flight animation is well documented, so the Android SDK would rely on a port of that code to Java.

  5. 1ec5 commented on Aug 25, 2017

    @1ec5
    ContributorAuthor

    See “Property-Based Animations” for some APIs that would be used with this feature, especially UIViewPropertyAnimator and UISpringTimingParameters (for spring-solving animations).

  6. 1ec5 commented on Sep 1, 2017

    @1ec5
    ContributorAuthor

    #9808 (comment) has a basic demo of UIView animations on MGLMapView. That issue is a bit more tightly scoped that this issue, with more caveats, but it offers a concrete look at how the more general feature would look.

    /cc @d-prukop

  7. jfirebaugh commented on Oct 18, 2017

    @jfirebaugh
    Contributor

    A disadvantage of SDK-driven animations that incrementally update the mbgl core camera is that the core tile loading algorithm then lacks knowledge about the overall animation that would allow it to optimize decisions about what tiles to load or not load, as suggested in issues such as mapbox/mapbox-gl-js#2470 and mapbox/mapbox-gl-js#5482.

  8. added
    archived
    on Jan 13, 2019
  9. stale commented on Jan 13, 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.

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

    archivediOSmacOSnavigationneeds discussionrefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions