|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 | # 效果动画 🌎
## Animation
> 场景动画基类
:::warning
该类无法实例化
:::
### methods
- **_start()_**
  开始动画
  - 返回值 `this`
- **_stop()_**
  停止动画
  - 返回值 `this`
## DC.AroundPoint
> 点位环绕,继承于[Animation](#animation)
### example
```js
let aroundPoint = new DC.AroundPoint(viewer, '120.121, 31.12')
aroundPoint.start()
```
### creation
- **_constructor(viewer,position,[options])_**
  构造函数
  - 参数
    - `{Viewer} viewer`:3D 场景
    - `{Position|String|Array} position`:点位
    - `{Object} options`:options
  - 返回值 `aroundPoint`
```json
//options(optional)
{
  "heading": 0, //偏移角度
  "pitch": 0, //翻转角度
  "range": 0, //距离
  "duration": 0, //间隔,单位:秒,当此值大于0时,callback才会生效
  "callback": null, //完成回调函数
  "context": null //回调函数执行上下文
}
```
## DC.AroundView
> 相机环绕,继承于[Animation](#animation)
### example
```js
let aroundView = new DC.AroundView(viewer)
aroundView.start()
```
### creation
- **_constructor(viewer,[options])_**
  构造函数
  - 参数
    - `{Viewer} viewer`:3D 场景
    - `{Object} options`:options
  - 返回值 `aroundView`
```json
//options(optional)
{
  "heading": 0, //偏移角度
  "pitch": 0, //俯仰角度
  "roll": 0, //翻转角度
  "duration": 0, //间隔,单位:秒,当此值大于0时,callback才会生效
  "callback": null, //完成回调函数
  "context": null //回调函数执行上下文
}
```
## DC.Flying
> 定点巡航,继承于[Animation](#animation)
### example
```js
let flying = new DC.Flying(viewer)
flying.positions = ['121.234,21.212,0,-29', '121.435,21.212,0,-29']
flying.start()
```
### creation
- **_constructor(viewer,[options])_**
  构造函数
  - 参数
    - `{Viewer} viewer`:场景
    - `{Object} options`:options
  - 返回值 `flying`
```json
// 属性参数(optional)
{
  "loop": false, //是否循环,
  "dwellTime": 3, //驻留时间
  "callback": null //回调函数
}
```
### properties
- `{Array} positions`:点位
- `{Array} durations`:每个点位的飞行间隔时间,当数组长度为 1 时,每个间隔时间相同,如果不为 1 时,长度必须和点位长度相等
### methods
- **_start()_**
  开始动画
  - 返回值 `this`
- **_pause()_**
  暂停
  - 返回值 `this`
- **_restore()_**
  继续
  - 返回值 `this`
## DC.GlobeRotate
> 地球自转,继承于[Animation](#animation)
### example
```js
let globeRotate = new DC.GlobeRotate(viewer, {
  duration: 5,
  speed: 1000,
  callback: () => {},
})
globeRotate.start()
```
### creation
- **_constructor(viewer,[options])_**
  构造函数
  - 参数
    - `{DC.Viewer} viewer`:3D 场景
    - `{Object} options`:options
  - 返回值 `globeRotate`
```json
//options(optional)
{
  "speed": 12 * 1000, //速度
  "duration": 0, //持续时间,当此值大于0时,callback才会生效
  "callback": null, //执行完成的回调函数
  "context": null //回调函数执行上下文
}
```
## DC.RoamingController
> 漫游控制
### example
```js
let rc = new DC.RoamingController(viewer)
```
### creation
- **_constructor(viewer)_**
  构造函数
  - 参数
    - `{Viewer} viewer`:3D 场景
  - 返回值 `roamingController`
### methods
- **_addPath(path)_**
  添加路径
  - 参数
    - `{RoamingPath} path`:路径
  - 返回值 `this`
- **_addPaths(paths)_**
  添加路径数组
  - 参数
    - `{Array<RoamingPath>} paths`:路径数组
  - 返回值 `this`
- **_removePath(path)_**
  移除路径
  - 参数
    - `{RoamingPath} path`:路径
  - 返回值 `path`
- **_getPath(id)_**
  根据唯一标识获取路径
  - 参数
    - `{String} id`:唯一标识
  - 返回值 `path`
- **_getPaths()_**
  获取所有路径
  - 返回值 `array`
- **_activate(path, viewOption)_**
  激活漫游
  - 参数
    - `{RoamingPath} path`:路径
    - `{String} viewOption`:漫游参数
  - 返回值 `this`
```json
// 漫游参数(可选)
{
  "pitch": 0, // 俯仰角
  "range": 1000 // 距离
}
```
- **_deactivate()_**
  结束漫游
  - 返回值 `this`
- **_clear()_**
  移除所有路径
  - 返回值 `this`
## DC.RoamingPath
> 漫游路径
### example
```js
let path = new DC.RoamingPath('120.121,32.1213;121.132,32.1213', 20)
rc.addPath(path)
```
### creation
- **_constructor(positions, duration, [pathMode])_**
  构造函数
  - 参数
    - `{String|Array<Position|Number|String|Object>} positions`:坐标串
    - `{Number} duration`:间隔时间,单位:秒
    - `{String} pathMode`:路径模式:speed(匀速) / time(等时)
  - 返回值 `roamingPath`
### properties
- `{String} pathId`:唯一标识 **_`readonly`_**
- `{String} id`:业务唯一标识
- `{String|Array<Position|Number|String>} positions`:坐标串
- `{Number} duration`:间隔时间,单位:秒
- `{String} pathMode`:路径模式:speed(匀速) / time(等时)
- `{String} state`:状态 **_`readonly`_**
## DC.KeyboardRoaming
> 键盘漫游
### example
```js
let kr = new DC.KeyboardRoaming(viewer)
kr.enable = true
```
### creation
- **_constructor(viewer)_**
  构造函数
  - 参数
    - `{Viewer} viewer`:3D 场景
  - 返回值 `keyboardRoaming`
### properties
- `{Boolean} enable`:是否启用
- `{Number} moveRate`:移动变化率:100
- `{Number} rotateRate`:旋转变化率:0.01
## DC.TrackController
> 历史轨迹控制
### example
```js
let tc = new DC.TrackController(viewer)
```
### creation
- **_constructor(viewer)_**
  构造函数
  - 参数
    - `{Viewer} viewer`:3D 场景
  - 返回值 `trackController`
### methods
- **_addTrack(track)_**
  添加轨迹
  - 参数
    - `{Track} track`:轨迹
  - 返回值 `this`
- **_addTracks(tracks)_**
  添加轨迹数组
  - 参数
    - `{Array<Track>} tracks`:轨迹数组
  - 返回值 `this`
- **_removeTrack(track)_**
  移除轨迹
  - 参数
    - `{Track} track`:轨迹
  - 返回值 `path`
- **_getTrack(id)_**
  根据业务唯一标识获取轨迹
  - 参数
    - `{String} id`:业务唯一标识
  - 返回值 `track`
- **_getTracks()_**
  获取所有轨迹
  - 返回值 `array`
- **_play()_**
  播放
  - 返回值 `this`
- **_pause()_**
  暂停
  - 返回值 `this`
- **_restore()_**
  继续播放
  - 返回值 `this`
- **_viewTrack(track, viewOption)_**
  跟踪某一条路径
  - 参数
    - `{Track} track`:路径
    - `{String} viewOption`:配置信息
  - 返回值 `this`
```json
// 属性参数(可选)
{
  "mode": null, // 视角模式:DC.TrackViewMode
  "pitch": 0, // 俯仰角,第一视角有效
  "range": 1000 // 距离
}
```
- **_releaseTrack(track)_**
  取消跟踪某一条轨迹
  - 参数
    - `{Track} track`:路径
  - 返回值 `this`
- **_clear()_**
  移除所有路径
  - 返回值 `this`
## DC.Track
> 轨迹
### example
```js
let tc = new DC.TrackController(viewer)
let track = new DC.Track('120.121,32.1213;121.132,32.1213', 20)
tc.addTrack(track)
```
### creation
- **_constructor(positions, duration, [callback], [options])_**
  构造函数
  - 参数
    - `{String|Array<Position|Number|String|Object>} positions`:坐标串
    - `{Number} duration`:间隔时间,单位:秒
    - `{Function} callback`:每一个点位到达回调函数,参数有:position(位置信息),isLast(是否为最后的点位)
    - `{Object} options`: 配置参数
  - 返回值 `track`
```json
//配置参数(可选)
{
  "clampToGround": false, // 是否贴地
  "clampToTileset": false, // 是否贴物
  "interpolationType": "Linear", // 插值类型:Linear、Hermite、Lagrange
  "interpolationDegree": 2, // 插值度数
  "endDelayTime": 0.5, // 结束时间延长时间,单位:秒,
  "headingOffset": 0 //旋转偏移
}
```
### properties
- `{String} trackId`:唯一标识 **_`readonly`_**
- `{String} id`:业务唯一标识
- `{String|Array<Position|Number|String|Object>} positions`:坐标串
- `{Number} duration`:间隔时间,单位:秒
- `{Date} startTime`:开始时间,设置后会独立于控制器的开始时间
- `{String} state`:状态 **_`readonly`_**
### methods
- **_addPosition(position,duration)_**
  添加点位
  - 参数
    - `{Position|Array|String|Object} position`:点位
    - `{Number} duration`:间隔,单位:秒
  - 返回值 `this`
- **_setModel(modelUrl,style)_**
  设置模型
  - 参数
    - `{String} modelPath`:模型路径
    - `{Object} style`:样式,详情参考:[DC.Model](./overlay-vector#dc-model)
  - 返回值 `this`
- **_setBillboard(icon,style)_**
  设置图标
  - 参数
    - `{String} icon`:图标路径
    - `{Object} style`:样式,参考:[DC.Billboard](./overlay-vector#dc-billboard)
  - 返回值 `this`
- **_setLabel(text,style)_**
  设置文本
  - 参数
    - `{String} text`:文本
    - `{Object} style`:样式,参考:[DC.Label](./overlay-vector#dc-label)
  - 返回值 `this`
- **_setPath(visible,style)_**
  设置路径
  - 参数
    - `{Boolean}} visible`:是否可见
    - `{Object} style`:样式,参考:[DC.Polyline](./overlay-vector#dc-polyline)
  - 返回值 `this`
 |