You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

effect-animation.md 9.2KB

2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
1 ay önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
2 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. # 效果动画 🌎
  2. ## Animation
  3. > 场景动画基类
  4. :::warning
  5. 该类无法实例化
  6. :::
  7. ### methods
  8. - **_start()_**
  9. 开始动画
  10. - 返回值 `this`
  11. - **_stop()_**
  12. 停止动画
  13. - 返回值 `this`
  14. ## DC.AroundPoint
  15. > 点位环绕,继承于[Animation](#animation)
  16. ### example
  17. ```js
  18. let aroundPoint = new DC.AroundPoint(viewer, '120.121, 31.12')
  19. aroundPoint.start()
  20. ```
  21. ### creation
  22. - **_constructor(viewer,position,[options])_**
  23. 构造函数
  24. - 参数
  25. - `{Viewer} viewer`:3D 场景
  26. - `{Position|String|Array} position`:点位
  27. - `{Object} options`:options
  28. - 返回值 `aroundPoint`
  29. ```js
  30. //options(可选)
  31. const config = {
  32. "heading": 0, //偏移角度
  33. "pitch": 0, //翻转角度
  34. "range": 0, //距离
  35. "duration": 0, //间隔,单位:秒,当此值大于0时,callback才会生效
  36. "callback": null, //完成回调函数
  37. "context": null //回调函数执行上下文
  38. }
  39. ```
  40. ## DC.AroundView
  41. > 相机环绕,继承于[Animation](#animation)
  42. ### example
  43. ```js
  44. let aroundView = new DC.AroundView(viewer)
  45. aroundView.start()
  46. ```
  47. ### creation
  48. - **_constructor(viewer,[options])_**
  49. 构造函数
  50. - 参数
  51. - `{Viewer} viewer`:3D 场景
  52. - `{Object} options`:options
  53. - 返回值 `aroundView`
  54. ```js
  55. //options(可选)
  56. const options = {
  57. "heading": 0,//偏移角度
  58. "pitch": 0,//俯仰角度
  59. "roll": 0,//翻转角度
  60. "duration": 0,//间隔,单位:秒,当此值大于0时,callback才会生效
  61. "callback": null,//完成回调函数
  62. "context": null//回调函数执行上下文
  63. }
  64. ```
  65. ## DC.Flying
  66. > 定点巡航,继承于[Animation](#animation)
  67. ### example
  68. ```js
  69. let flying = new DC.Flying(viewer)
  70. flying.positions = ['121.234,21.212,0,-29', '121.435,21.212,0,-29']
  71. flying.start()
  72. ```
  73. ### creation
  74. - **_constructor(viewer,[options])_**
  75. 构造函数
  76. - 参数
  77. - `{Viewer} viewer`:场景
  78. - `{Object} options`:options
  79. - 返回值 `flying`
  80. ```js
  81. // 属性参数(可选)
  82. const options = {
  83. "loop": false,//是否循环,
  84. "dwellTime": 3,//驻留时间
  85. "callback": null//回调函数
  86. }
  87. ```
  88. ### properties
  89. - `{Array} positions`:点位
  90. - `{Array} durations`:每个点位的飞行间隔时间,当数组长度为 1 时,每个间隔时间相同,如果不为 1 时,长度必须和点位长度相等
  91. ### methods
  92. - **_start()_**
  93. 开始动画
  94. - 返回值 `this`
  95. - **_pause()_**
  96. 暂停
  97. - 返回值 `this`
  98. - **_restore()_**
  99. 继续
  100. - 返回值 `this`
  101. ## DC.GlobeRotate
  102. > 地球自转,继承于[Animation](#animation)
  103. ### example
  104. ```js
  105. let globeRotate = new DC.GlobeRotate(viewer, {
  106. duration: 5,
  107. speed: 1000,
  108. callback: () => {
  109. },
  110. })
  111. globeRotate.start()
  112. ```
  113. ### creation
  114. - **_constructor(viewer,[options])_**
  115. 构造函数
  116. - 参数
  117. - `{DC.Viewer} viewer`:3D 场景
  118. - `{Object} options`:options
  119. - 返回值 `globeRotate`
  120. ```json
  121. //options(optional)
  122. {
  123. "speed": 12
  124. *
  125. 1000,
  126. //速度
  127. "duration": 0,
  128. //持续时间,当此值大于0时,callback才会生效
  129. "callback": null,
  130. //执行完成的回调函数
  131. "context": null
  132. //回调函数执行上下文
  133. }
  134. ```
  135. ## DC.RoamingController
  136. > 漫游控制
  137. ### example
  138. ```js
  139. let rc = new DC.RoamingController(viewer)
  140. ```
  141. ### creation
  142. - **_constructor(viewer)_**
  143. 构造函数
  144. - 参数
  145. - `{Viewer} viewer`:3D 场景
  146. - 返回值 `roamingController`
  147. ### methods
  148. - **_addPath(path)_**
  149. 添加路径
  150. - 参数
  151. - `{RoamingPath} path`:路径
  152. - 返回值 `this`
  153. - **_addPaths(paths)_**
  154. 添加路径数组
  155. - 参数
  156. - `{Array<RoamingPath>} paths`:路径数组
  157. - 返回值 `this`
  158. - **_removePath(path)_**
  159. 移除路径
  160. - 参数
  161. - `{RoamingPath} path`:路径
  162. - 返回值 `path`
  163. - **_getPath(id)_**
  164. 根据唯一标识获取路径
  165. - 参数
  166. - `{String} id`:唯一标识
  167. - 返回值 `path`
  168. - **_getPaths()_**
  169. 获取所有路径
  170. - 返回值 `array`
  171. - **_activate(path, viewOption)_**
  172. 激活漫游
  173. - 参数
  174. - `{RoamingPath} path`:路径
  175. - `{String} viewOption`:漫游参数
  176. - 返回值 `this`
  177. ```json
  178. // 漫游参数(可选)
  179. {
  180. "pitch": 0,
  181. // 俯仰角
  182. "range": 1000
  183. // 距离
  184. }
  185. ```
  186. - **_deactivate()_**
  187. 结束漫游
  188. - 返回值 `this`
  189. - **_clear()_**
  190. 移除所有路径
  191. - 返回值 `this`
  192. ## DC.RoamingPath
  193. > 漫游路径
  194. ### example
  195. ```js
  196. let path = new DC.RoamingPath('120.121,32.1213;121.132,32.1213', 20)
  197. rc.addPath(path)
  198. ```
  199. ### creation
  200. - **_constructor(positions, duration, [pathMode])_**
  201. 构造函数
  202. - 参数
  203. - `{String|Array<Position|Number|String|Object>} positions`:坐标串
  204. - `{Number} duration`:间隔时间,单位:秒
  205. - `{String} pathMode`:路径模式:speed(匀速) / time(等时)
  206. - 返回值 `roamingPath`
  207. ### properties
  208. - `{String} pathId`:唯一标识 **_`readonly`_**
  209. - `{String} id`:业务唯一标识
  210. - `{String|Array<Position|Number|String>} positions`:坐标串
  211. - `{Number} duration`:间隔时间,单位:秒
  212. - `{String} pathMode`:路径模式:speed(匀速) / time(等时)
  213. - `{String} state`:状态 **_`readonly`_**
  214. ## DC.KeyboardRoaming
  215. > 键盘漫游
  216. ### example
  217. ```js
  218. let kr = new DC.KeyboardRoaming(viewer)
  219. kr.enable = true
  220. ```
  221. ### creation
  222. - **_constructor(viewer)_**
  223. 构造函数
  224. - 参数
  225. - `{Viewer} viewer`:3D 场景
  226. - 返回值 `keyboardRoaming`
  227. ### properties
  228. - `{Boolean} enable`:是否启用
  229. - `{Number} moveRate`:移动变化率:100
  230. - `{Number} rotateRate`:旋转变化率:0.01
  231. ## DC.TrackController
  232. > 历史轨迹控制
  233. ### example
  234. ```js
  235. let tc = new DC.TrackController(viewer)
  236. ```
  237. ### creation
  238. - **_constructor(viewer)_**
  239. 构造函数
  240. - 参数
  241. - `{Viewer} viewer`:3D 场景
  242. - 返回值 `trackController`
  243. ### methods
  244. - **_addTrack(track)_**
  245. 添加轨迹
  246. - 参数
  247. - `{Track} track`:轨迹
  248. - 返回值 `this`
  249. - **_addTracks(tracks)_**
  250. 添加轨迹数组
  251. - 参数
  252. - `{Array<Track>} tracks`:轨迹数组
  253. - 返回值 `this`
  254. - **_removeTrack(track)_**
  255. 移除轨迹
  256. - 参数
  257. - `{Track} track`:轨迹
  258. - 返回值 `path`
  259. - **_getTrack(id)_**
  260. 根据业务唯一标识获取轨迹
  261. - 参数
  262. - `{String} id`:业务唯一标识
  263. - 返回值 `track`
  264. - **_getTracks()_**
  265. 获取所有轨迹
  266. - 返回值 `array`
  267. - **_play()_**
  268. 播放
  269. - 返回值 `this`
  270. - **_pause()_**
  271. 暂停
  272. - 返回值 `this`
  273. - **_restore()_**
  274. 继续播放
  275. - 返回值 `this`
  276. - **_viewTrack(track, viewOption)_**
  277. 跟踪某一条路径
  278. - 参数
  279. - `{Track} track`:路径
  280. - `{String} viewOption`:配置信息
  281. - 返回值 `this`
  282. ```json
  283. // 属性参数(可选)
  284. {
  285. "mode": null,
  286. // 视角模式:DC.TrackViewMode
  287. "pitch": 0,
  288. // 俯仰角,第一视角有效
  289. "range": 1000
  290. // 距离
  291. }
  292. ```
  293. - **_releaseTrack(track)_**
  294. 取消跟踪某一条轨迹
  295. - 参数
  296. - `{Track} track`:路径
  297. - 返回值 `this`
  298. - **_clear()_**
  299. 移除所有路径
  300. - 返回值 `this`
  301. ## DC.Track
  302. > 轨迹
  303. ### example
  304. ```js
  305. let tc = new DC.TrackController(viewer)
  306. let track = new DC.Track('120.121,32.1213;121.132,32.1213', 20)
  307. tc.addTrack(track)
  308. ```
  309. ### creation
  310. - **_constructor(positions, duration, [callback], [options])_**
  311. 构造函数
  312. - 参数
  313. - `{String|Array<Position|Number|String|Object>} positions`:坐标串
  314. - `{Number} duration`:间隔时间,单位:秒
  315. - `{Function} callback`:每一个点位到达回调函数,参数有:position(位置信息),isLast(是否为最后的点位)
  316. - `{Object} options`: 配置参数
  317. - 返回值 `track`
  318. ```json
  319. //配置参数(可选)
  320. {
  321. "clampToGround": false,
  322. // 是否贴地
  323. "clampToTileset": false,
  324. // 是否贴物
  325. "interpolationType": "Linear",
  326. // 插值类型:Linear、Hermite、Lagrange
  327. "interpolationDegree": 2,
  328. // 插值度数
  329. "endDelayTime": 0.5,
  330. // 结束时间延长时间,单位:秒,
  331. "headingOffset": 0
  332. //旋转偏移
  333. }
  334. ```
  335. ### properties
  336. - `{String} trackId`:唯一标识 **_`readonly`_**
  337. - `{String} id`:业务唯一标识
  338. - `{String|Array<Position|Number|String|Object>} positions`:坐标串
  339. - `{Number} duration`:间隔时间,单位:秒
  340. - `{Date} startTime`:开始时间,设置后会独立于控制器的开始时间
  341. - `{String} state`:状态 **_`readonly`_**
  342. ### methods
  343. - **_addPosition(position,duration)_**
  344. 添加点位
  345. - 参数
  346. - `{Position|Array|String|Object} position`:点位
  347. - `{Number} duration`:间隔,单位:秒
  348. - 返回值 `this`
  349. - **_setModel(modelUrl,style)_**
  350. 设置模型
  351. - 参数
  352. - `{String} modelPath`:模型路径
  353. - `{Object} style`:样式,详情参考:[DC.Model](./overlay-vector#dc-model)
  354. - 返回值 `this`
  355. - **_setBillboard(icon,style)_**
  356. 设置图标
  357. - 参数
  358. - `{String} icon`:图标路径
  359. - `{Object} style`:样式,参考:[DC.Billboard](./overlay-vector#dc-billboard)
  360. - 返回值 `this`
  361. - **_setLabel(text,style)_**
  362. 设置文本
  363. - 参数
  364. - `{String} text`:文本
  365. - `{Object} style`:样式,参考:[DC.Label](./overlay-vector#dc-label)
  366. - 返回值 `this`
  367. - **_setPath(visible,style)_**
  368. 设置路径
  369. - 参数
  370. - `{Boolean}} visible`:是否可见
  371. - `{Object} style`:样式,参考:[DC.Polyline](./overlay-vector#dc-polyline)
  372. - 返回值 `this`