Open-source project
amalChandran/trail-android avatar
amalChandran/trail-android

Trail for Android animates a foreground over an existing route

🚕 Simple, smooth animation for route / polylines on google maps using projections.

516 stars123 forksKotlinMIT

At a glance

What is it?
Trail pairs Kotlin route effects with Canvas, Compose and Google Maps renderers. The Android candidate uses locally staged Maven artifacts.
Who is it for?
Trail fits Android teams that already have route geometry and need a moving foreground with a visible base path. A screen that only needs a fixed route can use the map SDK's polyline directly.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 49 days ago.
What is it written in?
Mainly Kotlin, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 20, 2026, and from our analysis. They are not legal advice.

Editorial analysis

A route that remains visible throughout an animation

Trail for Android is a Kotlin library for applications that already have a path to draw. A delivery screen may need to show a complete route while a smaller moving pattern indicates direction. A directions screen may want a temporary loading arc before its route service responds. The repository addresses the presentation of that geometry through Android View and Canvas, Compose Canvas, and Google Maps integrations.

The distinction between the base path and the moving foreground matters when a user needs to read the route at any point in the animation. The six route presets shown in the README retain a base route. Moving dots and dashes travel along it, while the loading preset sends a segment along it. Route sweep draws a foreground color over the path and then fades it. The choice changes how the foreground communicates progress even though the underlying route stays visible.

How the Kotlin effect travels between renderers

The README defines a simple effect by pairing a stroke with a timed reveal in the typed DSL. It passes that effect to TrailCanvas together with a path. The Google Maps example passes the effect to GoogleMapsTrail inside the existing GoogleMap content, together with the route and camera state. An Android View can receive an effect through its effect property. That division allows the visual choice to be expressed alongside the motion and then applied at the surface that owns the path.

The distribution guide assigns geometry, effect definitions and playback to trail-core. It lists separate adapters for Android Canvas, Compose and Google Maps, with named presets available through trail-effects. For example, an app that draws a progress line on a Compose Canvas can start with the Compose adapter. An app that displays the same idea over live map tiles needs the Google Maps integration because the camera and geographic coordinates are part of that rendering problem.

Why geographic anchoring changes the map integration

The map example places the route and optional vehicle inside the map as geographic objects. The map engine transforms those objects during camera movement. In the README, the repository contrasts this behavior with its earlier screen overlay, where projection feedback could make the route sway. A practical evaluation is to pan, rotate and tilt around a visible corner with animation running, then examine whether the moving foreground continues to follow the same road geometry.

The optional vehicle is supplied by the caller as an up-facing bitmap descriptor. Trail centers it at the moving route head and adjusts its orientation along the path. The sample art belongs to the playground. A product that needs its own vehicle symbol therefore has an asset to supply as part of the integration. The cab example follows a sample road route, whereas the flight and ferry examples use illustrative connections. Those displays demonstrate rendering behaviors with different path shapes.

Stage the Android candidate and open the route playground

The distribution guide describes 2.0.0-alpha02 as a local candidate. Start in the repository checkout and run the documented preparation script.

bash
scripts/release/prepare-android.sh

The script assembles and lints the release playground and stages the SDK artifacts. The guide locates the Maven staging repository at android/build/release-repository and describes adding its absolute path to a consuming application's Gradle settings. The preparation script copies the example APK to artifacts/release/trail-studio-example.apk. The script stages everything locally.

In the playground, open Route Animation below the progress slider and select Moving Dots. Turn on Google Maps preview to examine the same preset on a native map. The documentation defines the duration for dots and dashes as one pattern step, while the other route animation options use a route cycle. Changing duration can therefore speed up the pattern without setting the time for a vehicle to traverse the whole route. The README also documents a static rendering for reduced motion.

Choose a static map polyline or plan for a Trail migration

The Google Maps Android SDK's shapes guide shows how to declare a polyline with PolylineOptions and add it directly to a map. For an application that displays a fixed route with a single stroke, that API can handle the display within the existing map integration. Trail adds effect definitions and playback controls for a changing foreground over the same route. Its loading transition is useful when the presentation needs to move from a temporary arc to a detailed path supplied later by the application.

The repository's license file states MIT. Android teams evaluating this candidate should budget for making the staged Maven artifacts accessible to their build. The distribution guide treats the former Java and JitPack API under legacy as a migration when moving to version 2. A team replacing AnimationRouteHelper has both dependency changes and call sites to check. The upstream last push recorded for the project was on 2026-10-08.

[Trail Android repository](https://github.com/amalChandran/trail-android) · [Distribution guide](https://github.com/amalChandran/trail-android/blob/50a3f01e875c84c6bebd6360eaf8ee7afabc6e87/docs/DISTRIBUTION.md) · [Google Maps Android shapes](https://developers.google.com/maps/documentation/android-sdk/shapes)

Editorial conclusion

Trail fits Android teams that already have route geometry and need a moving foreground with a visible base path. A screen that only needs a fixed route can use the map SDK's polyline directly. For an animated map, stage the Android candidate and compare a preset under camera rotation in the playground before migrating existing calls.

Frequently asked questions

How do I try Trail for Android?

The distribution guide uses the repository's Android preparation script to stage Maven artifacts and build the example APK.

Can Trail for Android render inside a Google Map?

Yes. The README puts GoogleMapsTrail inside the GoogleMap content and describes the route and vehicle as geographic map objects.

Does Trail for Android keep a route visible while the foreground moves?

The six route presets shown in the README retain a visible base route while animating the foreground.

Official sources

  1. amalChandran/trail-android on GitHub
  2. Issues
  3. License: MIT
  4. README
  5. Releases

Was this useful?