-
-
Notifications
You must be signed in to change notification settings - Fork 15
Polyline
Muhammad Utsman edited this page Jul 30, 2021
·
2 revisions
You can animating the polyline with easier code. There is a feature to determine the draw of the animation.
implementation 'io.github.utsmannn:geolib-polyline:{last_version}'
val animatorBuilder: PolylineAnimatorBuilder = googleMap.createPolylineAnimatorBuilder()
val polylineAnimator: PolylineAnimtor = animatorBuilder.createPolylineAnimator()
Param | type | desc |
---|---|---|
withPrimaryPolyline(PolylineOptions.() -> Unit) |
PolylineAnimatorBuilder |
DSL param for add primary polyline |
withAccentPolyline(PolylineOptions.() -> Unit) |
PolylineAnimatorBuilder |
DSL param for add accent polyline |
withCameraAutoFocus(Boolean) |
PolylineAnimatorBuilder |
Set for auto zoom camera |
withStackAnimationMode(StackAnimationMode) |
PolylineAnimatorBuilder |
Set for animate type polyline |
createAnimatePolyline() |
PolylineAnimator |
to create PolylineAnimator
|
To start animate use startAnimate(geometries: List<LatLng>, duration: Long)
and result is PointPolyline
val point = polylineAnimator.startAnimate(geometries, 2000)
With PolylineOptions
val polyline = googleMap.addPolyline(polylineOptions)
polyline.withAnimate(googleMap, polylineOptions) {
stackAnimationMode = StackAnimationMode.BlockStackAnimation
}
Or with PolylineAnimator
val polyline = googleMap.addPolyline(options)
polyline.withAnimate(polylineAnimator) {
polylineDrawMode = PolylineDrawMode.Normal
}
You can added polyline in existing polyline
val nextPoint = point.addPoints(nextGeometries)
Remove polyline on PointPolyline
val isRemoveSuccess = nextPoint.remove()
Or by geometries
val isRemoveSuccess = point.remove(nextGeometries)
Param | return | desc |
---|---|---|
withPrimaryPolyline(PolylineOptions.() -> Unit) |
Unit |
DSL param for add primary polyline |
withAccentPolyline(PolylineOptions.() -> Unit) |
Unit |
DSL param for add accent polyline |
duration |
Long |
Duration of animation |
cameraAutoUpdate |
Boolean |
Set for auto zoom camera |
stackAnimationMode |
StackAnimationMode |
Set for animate type polyline |
polylineDrawMode |
PolylineDrawMode |
Set for draw type polyline |
enableBorder(isEnable: Boolean, color: Int, width: Int) |
Unit |
Set for border of polyline |
doOnStartAnimation(action: (LatLng) -> Unit) |
Unit |
Do action when animation is start |
doOnEndAnimation(action: (LatLng) -> Unit) |
Unit |
Do action when animation is finish |
doOnUpdateAnimation(action: (latLng: LatLng, mapCameraDuration: Int) -> Unit) |
Unit |
Do action when animation is update with duration for camera movement |
This is animation type of polyline
- Button 1:
StackAnimationMode.BlockStackAnimation
(this default configuration) - Button 2:
StackAnimationMode.WaitStackEndAnimation
- Button 2:
StackAnimationMode.OffStackAnimation
This library able to customize polyline draw mode
- Button 1:
PolylineDrawMode.Normal
(this default configuration) - Button 2:
PolylineDrawMode.Curved
- Button 2:
PolylineDrawMode.Lank