Cordova google maps plugin animate camera error

Hi,

I’m trying to do two thing, first get the current geolocation (working ok) and second have the map animate to that location (not working).

I’m using the following code which errors with .

Typescript Error
Cannot find name ‘map’

map.animateCamera({
            target: location,
            zoom: 14,
            tilt: 60,
            bearing: 140,
            duration: 2000
        }, function () { });

Also tried this.map.animateCamera but get the following . .

Typescript Error
Supplied parameters do not match any signature of call target.

Here is my loadmap function which is called in platform.ready.


  loadMap() {
    this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 5000, enableHighAccuracy: true}).then((resp) => {

      let location = new LatLng(resp.coords.latitude, resp.coords.longitude);

      this.map.animateCamera({
        target: location,
        zoom: 14,
        tilt: 60,
        bearing: 140,
        duration: 2000
      }, function () { });

      this.map = new GoogleMap('map', {
        'backgroundColor': 'white',
        'controls': {
          'compass': false,
          'myLocationButton': false,
          'indoorPicker': false,
          'zoom': false
        },
        'gestures': {
          'scroll': true,
          'tilt': false,
          'rotate': false,
          'zoom': true
        },
        'camera': {
          'latLng': location,
          'tilt': 20,
          'zoom': 16,
          'bearing': 0
        }
      this.map.on(GoogleMapsEvent.MAP_READY).subscribe(() => {
        console.log('Map is ready!');
      });
    }).catch((error) => {
      console.log('Error getting location', error);
    });
  } // End of load map