إضافة رسوم متحركة لمسار الكاميرا

اختيار النظام الأساسي: Android‏ iOS‏ JavaScript‏

يمكنك إضافة رسوم متحركة لمسار الكاميرا إلى خريطتك الثلاثية الأبعاد لتوفير تجربة أكثر تفاعلية للمستخدمين. يمكن أن تحلّق حركات مسار الكاميرا إلى نقطة على الخريطة أو حولها، أو يمكن دمجها لتحريك الكاميرا إلى نقطة على الخريطة، بما في ذلك تحديد ارتفاعها.

الانتقال إلى

توضّح عيّنة تعليمات برمجية التالية كيفية تحريك الكاميرا للانتقال إلى نقطة معيّنة على خريطة ثلاثية الأبعاد من خلال استدعاء طريقة flyCameraTo.

// Add imports and define constants
import com.google.android.gms.maps3d.model.Map3DMode
import com.google.android.gms.maps3d.model.latLngAltitude
const val EMPIRE_STATE_BUILDING_LATITUDE = 40.748233
const val EMPIRE_STATE_BUILDING_LONGITUDE = -73.985663

...

// Add to the onMap3DViewReady method, after the googleMap3D object has been initialized
googleMap3D.setMapMode(Map3DMode.HYBRID)
googleMap3D.flyCameraTo(
    flyToOptions {
        endCamera = camera {
            center = latLngAltitude {
                latitude = EMPIRE_STATE_BUILDING_LATITUDE
                longitude = EMPIRE_STATE_BUILDING_LONGITUDE
                altitude = 212.0 // in meters
            }
            heading = 34.0 // bearing in degrees
            tilt = 67.0 // relative to vertical
            range = 750.0 // distance away from the focal point in meters
            roll = 0.0 // roll relative to horizontal
        }
        durationInMillis = 2_000
    }
)

التنقّل في الأرجاء

يوضّح نموذج الرمز البرمجي التالي كيفية تحريك الكاميرا لتطير حول نقطة معيّنة على خريطة ثلاثية الأبعاد من خلال استدعاء طريقة flyCameraAround.

// Add imports and define constants
import com.google.android.gms.maps3d.model.Map3DMode
import com.google.android.gms.maps3d.model.latLngAltitude
const val EMPIRE_STATE_BUILDING_LATITUDE = 40.748233
const val EMPIRE_STATE_BUILDING_LONGITUDE = -73.985663

...

// Add to the onMap3DViewReady method, after the googleMap3D object has been initialized
googleMap3D.setMapMode(Map3DMode.HYBRID)
googleMap3D.flyCameraAround(
    flyAroundOptions {
        center = camera {
            center = latLngAltitude {
                latitude = EMPIRE_STATE_BUILDING_LATITUDE
                longitude = EMPIRE_STATE_BUILDING_LONGITUDE
                altitude = 212.0
            }
            heading = 34.0
            tilt = 67.0
            range = 750.0
            roll = 0.0
        }
        durationInMillis = 5_000
        rounds = 1.0 // Number of rotations - can be fractional
    }
)