This is a feature request. It'd be nice to have a .moveAnimated(center, zoom, ??).
Future animateMapMove(MapController mapController, int msDelay, LatLng center) {
mapController.move(center, 12.0);
return new Future.delayed(Duration(milliseconds: msDelay), () => "1");
}
animateMapMove(store.state.mapController, 100, LatLng(startingPoint.latitude + 1* incLat, startingPoint.longitude + 1* incLon))
.then( (t) => animateMapMove(store.state.mapController, 80, LatLng(startingPoint.latitude + 2* incLat, startingPoint.longitude + 2* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 30, LatLng(startingPoint.latitude + 3* incLat, startingPoint.longitude + 3* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 10, LatLng(startingPoint.latitude + 4* incLat, startingPoint.longitude + 4* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 10, LatLng(startingPoint.latitude + 5* incLat, startingPoint.longitude + 5* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 30, LatLng(startingPoint.latitude + 6* incLat, startingPoint.longitude + 6* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 80, LatLng(startingPoint.latitude + 7* incLat, startingPoint.longitude + 7* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 100, LatLng(startingPoint.latitude + 8* incLat, startingPoint.longitude + 8* incLon)))
.then( (t) => animateMapMove(store.state.mapController, 100, action.mapCenter))
;
I'd like to be able to use Flutter's animation features, but I can't seem to figure out how to get a reference to vsync. I'm new to Flutter. I guess just about everyone is.
final _latTween = new Tween<double>(begin: store.state.mapCenter.latitude, end: action.mapCenter.latitude);
final _lngTween = new Tween<double>(begin: store.state.mapCenter.longitude, end: action.mapCenter.longitude);
AnimationController controller;
Animation<double> animation;
// I can't figure out how to get a vsync in here. Might work if I could.
controller = new AnimationController(duration: const Duration(milliseconds: 2000), vsync:);
animation = new CurvedAnimation(parent: controller, curve: Curves.easeIn);
controller.addListener(() {
store.state.mapController.move(LatLng(_latTween.evaluate(animation), _lngTween.evaluate(animation)), 12.0);
});
controller.forward();
I'm not sure if we'd pass an AnimationController to the MapController, or vice-versa, or what.