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.

Use Android Choreographer to smooth Map animations #2410

Closed

Description

@ljbade

In Android's Project Butter (for Jelly Bean) they introduced Choreographer for animations to keep them synced with the rest of the system.

We should use postFrameCallback() method which provides an accurate frame time stamp to drive animations inside Map.

Activity

  1. added
    performance
    Android
    on Sep 24, 2015
  2. added this to the milestone on Sep 24, 2015
  3. ljbade commented on Sep 24, 2015

    @ljbade
    ContributorAuthor

    @jfirebaugh How does the current C++ animation system work? What would it take to plump the frame time stamp for the next frame that will be drawn (so basically what the state should be for the upcoming renderSync as we get from Android).

  4. ljbade commented on Sep 24, 2015

    @ljbade
    ContributorAuthor

    Here is the reasoning from the Android docs:

    Using the frame time helps to reduce inter-frame jitter because the frame time is fixed at the time the frame was scheduled to start, regardless of when the animations or drawing callback actually runs. All callbacks that run as part of rendering a frame will observe the same frame time so using the frame time also helps to synchronize effects that are performed by different callbacks.

  5. ljbade commented on Sep 24, 2015

    @ljbade
    ContributorAuthor

    Taking a look at the Android animation code, you do something like this:

    • someone requests an animated change - you schedule a postFrameCallback
    • on your first postFrameCallback you save that time stamp as the animation start time
    • subsequent animation updates use new postFrameCallback times
  6. ljbade commented on Sep 24, 2015

    @ljbade
    ContributorAuthor

    Transform would be easy to modify to use ^, basically don't set transitionStart until first call to updateTransitions. The updateTransitions would receive it's frame time from an optional parameter to renderSync

    MapData might be a bit trickier. Perhaps set animationTime in renderSync instead of update?

  7. ljbade commented on Sep 24, 2015

    @ljbade
    ContributorAuthor

    It would be interesting to see if iOS also provides a similar synced time source for driving animations.

  8. bleege commented on Sep 29, 2015

    @bleege
    Contributor

    @ljbade I believe most of this work on the iOS side was put down into the Core GL level as they originally tried using the rough iOS equivalent called CADisplayLink. Let's work with @1ec5 @incanus @friedbunny to see what they've done on the iOS side already and then reuse that if possible.

  9. incanus commented on Oct 1, 2015

    @incanus
    Contributor

    I'm not sure I understand the actual problem that this would solve in our particular case. Animations in the map view are entirely self-contained and don't need to be synced with anything as the map view itself handles updating native views atop (long stable in iOS, just recently synced on Android in #2409).

  10. ljbade commented on Oct 1, 2015

    @ljbade
    ContributorAuthor

    @incanus The more I think about it, I think you are right that this wont fix the sync issues, which really requires GL side user dot and InfoViews (even if just render them to bitmap then pass to GL texture).

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

    Androidperformance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions