如何在Yandex mapkit中设置多段线动画



我正在使用Yandex MapKit。我可以绘制路线(多段线(,但如何像这样设置动画?-https://yandex.ru/dev/maps/jsbox/2.1/polyline_animation

我试图通过ValueAnimator来实现。它适用于我的任务

private fun displayRoute(pointsList: List<Point>) {
val valueAnimator = ValueAnimator.ofInt(1, pointsList.size)
valueAnimator.duration = 1200
valueAnimator.addUpdateListener {
val polylineMapObject = binding?.mapViewOrderDetail?.map?.mapObjects?.addPolyline(
Polyline(pointsList.subList(0, it.animatedValue as Int))
)
polylineMapObject?.strokeColor = ContextCompat.getColor(requireActivity(), R.color.color_black)
}
valueAnimator.start()
}

相关内容

  • 没有找到相关文章

最新更新