Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

effect-animation.md 9.1KB

效果动画 🌎

Animation

场景动画基类

:::warning 该类无法实例化 :::

methods

  • start()

开始动画

  • 返回值 this

  • stop()

停止动画

  • 返回值 this

DC.AroundPoint

点位环绕,继承于Animation

example

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
//options(optional)
{
  "heading": 0, //偏移角度
  "pitch": 0, //翻转角度
  "range": 0, //距离
  "duration": 0, //间隔,单位:秒,当此值大于0时,callback才会生效
  "callback": null, //完成回调函数
  "context": null //回调函数执行上下文
}

DC.AroundView

相机环绕,继承于Animation

example

let aroundView = new DC.AroundView(viewer)
aroundView.start()

creation

  • constructor(viewer,[options])

构造函数

  • 参数
    • {Viewer} viewer:3D 场景
    • {Object} options:options
  • 返回值 aroundView
//options(optional)
{
  "heading": 0, //偏移角度
  "pitch": 0, //俯仰角度
  "roll": 0, //翻转角度
  "duration": 0, //间隔,单位:秒,当此值大于0时,callback才会生效
  "callback": null, //完成回调函数
  "context": null //回调函数执行上下文
}

DC.Flying

定点巡航,继承于Animation

example

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
// 属性参数(optional)
{
  "loop": false, //是否循环,
  "dwellTime": 3, //驻留时间
  "callback": null //回调函数
}

properties

  • {Array} positions:点位
  • {Array} durations:每个点位的飞行间隔时间,当数组长度为 1 时,每个间隔时间相同,如果不为 1 时,长度必须和点位长度相等

methods

  • start()

开始动画

  • 返回值 this

  • pause()

暂停

  • 返回值 this

  • restore()

继续

  • 返回值 this

DC.GlobeRotate

地球自转,继承于Animation

example

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
//options(optional)
{
  "speed": 12 * 1000, //速度
  "duration": 0, //持续时间,当此值大于0时,callback才会生效
  "callback": null, //执行完成的回调函数
  "context": null //回调函数执行上下文
}

DC.RoamingController

漫游控制

example

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
// 漫游参数(可选)
{
  "pitch": 0, // 俯仰角
  "range": 1000 // 距离
}
  • deactivate()

结束漫游

  • 返回值 this

  • clear()

移除所有路径

  • 返回值 this

DC.RoamingPath

漫游路径

example

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

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

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
// 属性参数(可选)
{
  "mode": null, // 视角模式:DC.TrackViewMode
  "pitch": 0, // 俯仰角,第一视角有效
  "range": 1000 // 距离
}
  • releaseTrack(track)

取消跟踪某一条轨迹

  • 参数
    • {Track} track:路径
  • 返回值 this

  • clear()

移除所有路径

  • 返回值 this

DC.Track

轨迹

example

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
//配置参数(可选)
{
  "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
  • 返回值 this

  • setBillboard(icon,style)

设置图标

  • 参数
    • {String} icon:图标路径
    • {Object} style:样式,参考:DC.Billboard
  • 返回值 this

  • setLabel(text,style)

设置文本

  • 参数
    • {String} text:文本
    • {Object} style:样式,参考:DC.Label
  • 返回值 this

  • setPath(visible,style)

设置路径

  • 参数
    • {Boolean}} visible:是否可见
    • {Object} style:样式,参考:DC.Polyline
  • 返回值 this