CameraLerpComponent()

new CameraLerpComponent()

地球上使用的的相机插值组件

Extends

  • THING.LerpComponent

Methods

correctUp()

地球模式下 校正相机的up 头朝地球于球心连线向外方向

earthCameraRotateBySpeed(param)

相机根据速度绕自身旋转

Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Default Description
speed Number <optional>
1 旋转速度
angle Number 旋转角度 如果不传则会一直旋转
onComplete function <optional>
旋转完后的回调

earthCameraRotateByTime(param)

相机根据时间自身旋转

Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Default Description
duration Number <optional>
1000 旋转时间 单位毫秒
angle Number <optional>
360 旋转角度
onComplete function <optional>
旋转完后的回调

earthFlyHome(param)

相机恢复初始状态 即看到整个地球的视角

Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Default Description
duration Number <optional>
1000 飞行时间
onComplete function 飞行完成的回调

earthFlyRotateBySpeed(param)

相机根据速度围绕目标点旋转

Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Default Description
speed Number <optional>
1 旋转速度 速度为负数代表与旋转角度代表的方向相反
angle Number 旋转角度 如果不传则会一直旋转 值为正代表顺时针旋转 值为负数代表逆时针旋转
target Number <optional>
目标点坐标 如果不传绕当前相机目标点旋转

earthFlyRotateByTime(param)

相机根据时间围绕目标点旋转

Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Default Description
duration Number <optional>
0 旋转时间 单位毫秒
angle Number <optional>
360 旋转角度 值为正代表顺时针旋转 值为负数代表逆时针旋转
target Number <optional>
目标点坐标 如果不传绕当前相机目标点旋转
onComplete function <optional>
旋转完后的回调

earthFlyTo(param)

地球上的飞

Parameters:
Name Type Description
param Object
Properties
Name Type Attributes Default Description
lonlat Array.<Number> 目标位置的经纬度(并非相机位置的经纬度)
height Number <optional>
10000 相机位置的离地高
duration Number <optional>
2000 飞行时间 单位ms
pitch Number <optional>
45 飞行结束时相机的俯仰角
heading Number <optional>
0 飞行结束时相机的方位角
directFly Boolean <optional>
false 是否直接飞过去(注意 该参数为true可能会穿地飞)
onComplete function 飞行结束的回调方法

fit(param)

根据目标对象计算最佳位置 一般用于调整摄像机最佳视角.

根据目标对象计算最佳位置 一般用于调整摄像机最佳视角
Parameters:
Name Type Description
param.target THING.Object3D 目标对象
param Object 参数列表
Properties
Name Type Attributes Default Description
time Number <optional>
1000 时间
onComplete function <optional>
飞行结束后的回调
Example
const geoPoint = app.query('.GeoPoint')[0];//假设地图上有一个GeoPoint对象
app.camera.fit(geoPoint);

flyToBoundingSphere(param)

飞到包围球

Parameters:
Name Type Description
param Object 参数列表
Properties
Name Type Attributes Default Description
radius Number 包围球半径
center Array.<Number> 包围球中心点
duration Number <optional>
3000 飞线时间 单位毫秒
onComplete function <optional>
飞行完后的回调

getEarthCameraInfo() → {Object}

获取地球上摄影机的参数,这里的height是基于相机位置基于圆球的高度,获取到的lonlat中不含高度 该方法主要是为了获取相机角度,再调用earthFlyTo时飞到正确的位置 如果添加地形的情况下,通过该方法获取的相机高度是不正确的

Returns:
Object - 地球上的相机参数 包括lonlat,height,heading,pitch

rotateToNorth()

相机指北

Parameters:
Name Type Attributes Default Description
param.duration Number <optional>
0 飞行时间 单位毫秒
param.onComplete function <optional>
飞行完后的回调

stopEarthFly()

停止地球上的相机飞行或旋转