Today we released version 3.0.0 of the Mapbox Android SDK, which includes numerous improvements and features including the Camera API.
The Camera API allows Android developers to move and change the position of the map’s camera, including its target, zoom, bearing, and tilt.
You can even specify the duration of the camera animations:
Sample code
The code below will create a camera animation similar to the one shown in the video above:
CameraPositioncameraPosition=newCameraPosition.Builder().target(newLatLng(-22.91214,-43.23012))// Sets the center of the map to Maracanã.bearing(270)// Sets the orientation of the camera to look west.tilt(20)// Sets the tilt of the camera to 30 degrees.build();// Creates a CameraPosition from the buildermMapView.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition),25000,null);
For more ready-to-go code examples, to start using this and many other SDK features in your apps, be sure to explore our Test App.
Visit the full changelog for a complete list of improvements included with this release.