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

Add the ability to progressively reveal / hide a line  #7

Closed

Description

@peterqliu

Animating a line draw is a common need in routing and transportation. I've previously simulated this in GL by chopping a line into a bunch of tiny segments and feeding them in one at a time (via setData), but it would be nice to do this in a less hacky fashion.

In SVG, this is done by turning the line into an extremely long dash, applying a dash-offset property to "push" the dash off the line, and then at runtime, animating the offset to 0. Maybe we can do something similar, or a simpler approach.

cc/ @lyzidiamond

Activity

  1. changed the title [-]Dash-offset property for line animations[/-] [+]Line animation[/+] on Dec 22, 2015
  2. tmcw commented on Dec 22, 2015

    @tmcw

    This should be folded into mapbox/mapbox-gl-js#1180 - mapbox-gl-js needs animation primitives and faster setData calls. We shouldn't copy the SVG line-dash hack, which is a hack.

  3. lucaswoj commented on Jan 25, 2016

    @lucaswoj

    It sounds like there are two separate issues in here:

    1. setData performance (more of a gl-js or gl-native specific issue, hopefully being addressed in Add "skipWorker" option to GeoJSON sources [DO NOT MERGE] mapbox-gl-js#1979). This is out of scope for this repo.
    2. displaying only part of a line, defined by start position and end position. This is an interesting discussion, complicated by the way geometries are sliced on tile boundaries.
  4. changed the title [-]Line animation[/-] [+]Add the ability to progressively reveal / hide a line [/+] on Jan 25, 2016
  5. tmcw commented on Jan 25, 2016

    @tmcw

    I don't think (2) should be considered. This is one of many potential animations: what about animating a polygon, or a line but from the other side, or from both ends? setData is the universal solution for animation and should be the sole focus.

  6. lucaswoj commented on Jan 26, 2016

    @lucaswoj

    The underlying issue here is "we need a faster setData". That's a platform-specific challenge which we're tackling (namely in mapbox/mapbox-gl-js#1979)

  7. jfirebaugh commented on Jan 26, 2016

    @jfirebaugh
    Contributor

    More generally there's the question of whether setData is even a suitable primitive for animations.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions