添加摄像头路径动画
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
您可以向 3D 地图添加相机路径动画,为用户提供更具沉浸感的体验。相机路径动画可以飞向或环绕地图上的某个点。
前往
以下代码示例演示了如何使用 Map.flyCameraTo
方法来使相机动画飞到 3D 地图上的特定点。
Swift
Map(mode: .hybrid)
.flyCameraTo(
camera:Camera = .init(
latitude: 47.6210296,
longitude: -122.3496903,
heading: 149.0,
tilt: 77.0,
roll: 0.0,
range: 4000)
duration: 5,
trigger: animate,
completion: { }
)
飞来飞去
以下代码示例演示了如何使用 Map.flyCameraAround
方法来使相机在 3D 地图上围绕特定点飞行。
Swift
Map(mode: .hybrid)
.flyCameraAround(
camera:Camera = .init(
latitude: 47.6210296,
longitude: -122.3496903,
heading: 149.0,
tilt: 77.0,
roll: 0.0,
range: 3000)
duration: 90,
rounds: 3,
trigger: flyAround,
callback: { }
)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[],[],null,["Select platform: [Android](/maps/documentation/maps-3d/android-sdk/custom-camera-paths \"View this page for the Android platform docs.\") [iOS](/maps/documentation/maps-3d/ios-sdk/custom-camera-paths \"View this page for the iOS platform docs.\")\n\n\u003cbr /\u003e\n\n| This product or feature is Experimental (pre-GA). Pre-GA products and features might have limited support, and changes to pre-GA products and features might not be compatible with other pre-GA versions. Pre-GA Offerings are covered by the [Google\n| Maps Platform Service Specific Terms](https://cloud.google.com/maps-platform/terms/maps-service-terms). For more information, see the [launch stage descriptions](/maps/launch-stages).\n\n\nYou can add camera paths animations to your 3D map to provide a more immersive\nexperience for your users. Camera path animations can fly to or fly around a point on the map.\n\nFly to\n\n\nThe following code sample demonstrates how to use the [`Map.flyCameraTo`](/maps/documentation/maps-3d/ios-sdk/reference/Extensions/View#flycamerato_:duration:trigger:completion) method to animate the camera to fly to a specific point on\na 3D map. \n\nSwift \n\n```swift\nMap(mode: .hybrid)\n.flyCameraTo(\n camera:Camera = .init(\n latitude: 47.6210296,\n longitude: -122.3496903,\n heading: 149.0,\n tilt: 77.0,\n roll: 0.0,\n range: 4000)\n duration: 5,\n trigger: animate,\n completion: { }\n)\n\n \n```\n\nFly around\n\n\nThe following code sample demonstrates how use the [`Map.flyCameraAround`](/maps/documentation/maps-3d/ios-sdk/reference/Extensions/View#flycameraaround_:duration:rounds:trigger:callback:) method to animate the camera to fly around a specific point on\na 3D map. \n\nSwift \n\n```swift\nMap(mode: .hybrid)\n .flyCameraAround(\n camera:Camera = .init(\n latitude: 47.6210296,\n longitude: -122.3496903,\n heading: 149.0,\n tilt: 77.0,\n roll: 0.0,\n range: 3000)\n duration: 90,\n rounds: 3,\n trigger: flyAround,\n callback: { }\n )\n\n \n```"]]