如何在谷歌地图ios中为GMSPolyline添加动画

我使用的是谷歌地图SDK,当用户移动时,我必须绘制折线,目前它只对标记进行动画处理,在引脚移动到特定位置之前绘制路径。我必须同时绘制路径和移动大头针。

查看此视频:https://www.dropbox.com/s/q5kdjf4iq0337vg/Map_Sample.mov?dl=0

以下是我的代码

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        let location = locations.last!
        userPath.addCoordinate(location.coordinate) //userPath -> GMSMutablePath
        let polyline = GMSPolyline(path: userPath)
        polyline.strokeColor = UIColor(red: 0, green: 191/255.0, blue: 1, alpha: 0.8)
        polyline.strokeWidth = 5
        CATransaction.begin()
        CATransaction.setAnimationDuration(2.0)
        self.userMarker.position = location.coordinate
        self.userMarker.rotation = location.course
        polyline.map = self.googleMapView
        CATransaction.commit()
    }

这里还有它现在是如何工作的截图

?

转载请注明出处:http://www.intsu.net/article/20230515/1602367.html