Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Drawn line behind moving SymbolLayer icon #998

Merged
merged 1 commit into from
Jun 20, 2019

Conversation

langsmith
Copy link
Contributor

This pr adds an example of drawing a LineLayer line behind a moving SymbolLayer icon. The icon moves along a pre-defined route. In this particular example, the route is from a Mapbox Directions API response.

ezgif com-resize

Inspired by the moving icon in the Wag! dogwalking app: https://play.google.com/store/apps/details?id=com.ionicframework.wagandroid554504&hl=en_US

ezgif com-resize (2)

Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both handler as animators are used to perform animation. One of those setups will be sufficient, not seeing a need for using both.

@langsmith langsmith force-pushed the ls-moving-icon-with-trailing-line branch from f24f593 to 21bf5a3 Compare April 8, 2019 21:35
@langsmith
Copy link
Contributor Author

Both handler as animators are used to perform animation. One of those setups will be sufficient, not seeing a need for using both.

My understanding was that the ObjectAnimator was animating the icon from Point to Point along the directions route. The runnable was making sure that the code was rolling through every Point along the line.

Anyways, I refactored the example to only use a Runnable. GIFs is below. It's very faint, but the difference from the ObjectAnimator / Runnable implementation seems to be that the line/icon movement looks to be more jerky. Can revert the commit if you think it's worth going back to the ObjectAnimator / Runnable combo...

300 millisecond runnable:
ezgif com-resize

50 millisecond runnable:
ezgif com-resize (1)

@langsmith langsmith force-pushed the ls-moving-icon-with-trailing-line branch 2 times, most recently from 36fef95 to 8da4a1a Compare April 12, 2019 00:42
@tobrun tobrun requested a review from LukasPaczos May 21, 2019 08:25
@langsmith
Copy link
Contributor Author

@tobrun , any further thoughts about my comment above?

@tobrun tobrun mentioned this pull request Jun 17, 2019
@tobrun
Copy link
Member

tobrun commented Jun 20, 2019

@LukasPaczos since I added code to this PR in #1109. I feel I'm not allowed to continue reviewing this PR. Can you take a look?

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, one comment and it should be good to go.

Copy link
Member

@LukasPaczos LukasPaczos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

*/
private void initData(Style fullyLoadedStyle, @NonNull FeatureCollection featureCollection) {
routeCoordinateList = ((LineString) featureCollection.features().get(0).geometry()).coordinates();
if (mapboxMap != null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: this check is redundant

@langsmith langsmith force-pushed the ls-moving-icon-with-trailing-line branch from 0808ee4 to fb27ce8 Compare June 20, 2019 14:51
@langsmith langsmith merged commit 74ecf70 into master Jun 20, 2019
@langsmith langsmith deleted the ls-moving-icon-with-trailing-line branch June 20, 2019 15:17
@langsmith langsmith mentioned this pull request Jun 21, 2019
5 tasks
@langsmith
Copy link
Contributor Author

Final version of the example looks like 🔽

ezgif com-resize

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants