Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

effect-animation.md 9.1KB

2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
2 anos atrás
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  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. ```json
  30. //options(optional)
  31. {
  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. ```json
  55. //options(optional)
  56. {
  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. ```json
  81. // 属性参数(optional)
  82. {
  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. globeRotate.start()
  111. ```
  112. ### creation
  113. - **_constructor(viewer,[options])_**
  114. 构造函数
  115. - 参数
  116. - `{DC.Viewer} viewer`:3D 场景
  117. - `{Object} options`:options
  118. - 返回值 `globeRotate`
  119. ```json
  120. //options(optional)
  121. {
  122. "speed": 12 * 1000, //速度
  123. "duration": 0, //持续时间,当此值大于0时,callback才会生效
  124. "callback": null, //执行完成的回调函数
  125. "context": null //回调函数执行上下文
  126. }
  127. ```
  128. ## DC.RoamingController
  129. > 漫游控制
  130. ### example
  131. ```js
  132. let rc = new DC.RoamingController(viewer)
  133. ```
  134. ### creation
  135. - **_constructor(viewer)_**
  136. 构造函数
  137. - 参数
  138. - `{Viewer} viewer`:3D 场景
  139. - 返回值 `roamingController`
  140. ### methods
  141. - **_addPath(path)_**
  142. 添加路径
  143. - 参数
  144. - `{RoamingPath} path`:路径
  145. - 返回值 `this`
  146. - **_addPaths(paths)_**
  147. 添加路径数组
  148. - 参数
  149. - `{Array<RoamingPath>} paths`:路径数组
  150. - 返回值 `this`
  151. - **_removePath(path)_**
  152. 移除路径
  153. - 参数
  154. - `{RoamingPath} path`:路径
  155. - 返回值 `path`
  156. - **_getPath(id)_**
  157. 根据唯一标识获取路径
  158. - 参数
  159. - `{String} id`:唯一标识
  160. - 返回值 `path`
  161. - **_getPaths()_**
  162. 获取所有路径
  163. - 返回值 `array`
  164. - **_activate(path, viewOption)_**
  165. 激活漫游
  166. - 参数
  167. - `{RoamingPath} path`:路径
  168. - `{String} viewOption`:漫游参数
  169. - 返回值 `this`
  170. ```json
  171. // 漫游参数(可选)
  172. {
  173. "pitch": 0, // 俯仰角
  174. "range": 1000 // 距离
  175. }
  176. ```
  177. - **_deactivate()_**
  178. 结束漫游
  179. - 返回值 `this`
  180. - **_clear()_**
  181. 移除所有路径
  182. - 返回值 `this`
  183. ## DC.RoamingPath
  184. > 漫游路径
  185. ### example
  186. ```js
  187. let path = new DC.RoamingPath('120.121,32.1213;121.132,32.1213', 20)
  188. rc.addPath(path)
  189. ```
  190. ### creation
  191. - **_constructor(positions, duration, [pathMode])_**
  192. 构造函数
  193. - 参数
  194. - `{String|Array<Position|Number|String|Object>} positions`:坐标串
  195. - `{Number} duration`:间隔时间,单位:秒
  196. - `{String} pathMode`:路径模式:speed(匀速) / time(等时)
  197. - 返回值 `roamingPath`
  198. ### properties
  199. - `{String} pathId`:唯一标识 **_`readonly`_**
  200. - `{String} id`:业务唯一标识
  201. - `{String|Array<Position|Number|String>} positions`:坐标串
  202. - `{Number} duration`:间隔时间,单位:秒
  203. - `{String} pathMode`:路径模式:speed(匀速) / time(等时)
  204. - `{String} state`:状态 **_`readonly`_**
  205. ## DC.KeyboardRoaming
  206. > 键盘漫游
  207. ### example
  208. ```js
  209. let kr = new DC.KeyboardRoaming(viewer)
  210. kr.enable = true
  211. ```
  212. ### creation
  213. - **_constructor(viewer)_**
  214. 构造函数
  215. - 参数
  216. - `{Viewer} viewer`:3D 场景
  217. - 返回值 `keyboardRoaming`
  218. ### properties
  219. - `{Boolean} enable`:是否启用
  220. - `{Number} moveRate`:移动变化率:100
  221. - `{Number} rotateRate`:旋转变化率:0.01
  222. ## DC.TrackController
  223. > 历史轨迹控制
  224. ### example
  225. ```js
  226. let tc = new DC.TrackController(viewer)
  227. ```
  228. ### creation
  229. - **_constructor(viewer)_**
  230. 构造函数
  231. - 参数
  232. - `{Viewer} viewer`:3D 场景
  233. - 返回值 `trackController`
  234. ### methods
  235. - **_addTrack(track)_**
  236. 添加轨迹
  237. - 参数
  238. - `{Track} track`:轨迹
  239. - 返回值 `this`
  240. - **_addTracks(tracks)_**
  241. 添加轨迹数组
  242. - 参数
  243. - `{Array<Track>} tracks`:轨迹数组
  244. - 返回值 `this`
  245. - **_removeTrack(track)_**
  246. 移除轨迹
  247. - 参数
  248. - `{Track} track`:轨迹
  249. - 返回值 `path`
  250. - **_getTrack(id)_**
  251. 根据业务唯一标识获取轨迹
  252. - 参数
  253. - `{String} id`:业务唯一标识
  254. - 返回值 `track`
  255. - **_getTracks()_**
  256. 获取所有轨迹
  257. - 返回值 `array`
  258. - **_play()_**
  259. 播放
  260. - 返回值 `this`
  261. - **_pause()_**
  262. 暂停
  263. - 返回值 `this`
  264. - **_restore()_**
  265. 继续播放
  266. - 返回值 `this`
  267. - **_viewTrack(track, viewOption)_**
  268. 跟踪某一条路径
  269. - 参数
  270. - `{Track} track`:路径
  271. - `{String} viewOption`:配置信息
  272. - 返回值 `this`
  273. ```json
  274. // 属性参数(可选)
  275. {
  276. "mode": null, // 视角模式:DC.TrackViewMode
  277. "pitch": 0, // 俯仰角,第一视角有效
  278. "range": 1000 // 距离
  279. }
  280. ```
  281. - **_releaseTrack(track)_**
  282. 取消跟踪某一条轨迹
  283. - 参数
  284. - `{Track} track`:路径
  285. - 返回值 `this`
  286. - **_clear()_**
  287. 移除所有路径
  288. - 返回值 `this`
  289. ## DC.Track
  290. > 轨迹
  291. ### example
  292. ```js
  293. let tc = new DC.TrackController(viewer)
  294. let track = new DC.Track('120.121,32.1213;121.132,32.1213', 20)
  295. tc.addTrack(track)
  296. ```
  297. ### creation
  298. - **_constructor(positions, duration, [callback], [options])_**
  299. 构造函数
  300. - 参数
  301. - `{String|Array<Position|Number|String|Object>} positions`:坐标串
  302. - `{Number} duration`:间隔时间,单位:秒
  303. - `{Function} callback`:每一个点位到达回调函数,参数有:position(位置信息),isLast(是否为最后的点位)
  304. - `{Object} options`: 配置参数
  305. - 返回值 `track`
  306. ```json
  307. //配置参数(可选)
  308. {
  309. "clampToGround": false, // 是否贴地
  310. "clampToTileset": false, // 是否贴物
  311. "interpolationType": "Linear", // 插值类型:Linear、Hermite、Lagrange
  312. "interpolationDegree": 2, // 插值度数
  313. "endDelayTime": 0.5, // 结束时间延长时间,单位:秒,
  314. "headingOffset": 0 //旋转偏移
  315. }
  316. ```
  317. ### properties
  318. - `{String} trackId`:唯一标识 **_`readonly`_**
  319. - `{String} id`:业务唯一标识
  320. - `{String|Array<Position|Number|String|Object>} positions`:坐标串
  321. - `{Number} duration`:间隔时间,单位:秒
  322. - `{Date} startTime`:开始时间,设置后会独立于控制器的开始时间
  323. - `{String} state`:状态 **_`readonly`_**
  324. ### methods
  325. - **_addPosition(position,duration)_**
  326. 添加点位
  327. - 参数
  328. - `{Position|Array|String|Object} position`:点位
  329. - `{Number} duration`:间隔,单位:秒
  330. - 返回值 `this`
  331. - **_setModel(modelUrl,style)_**
  332. 设置模型
  333. - 参数
  334. - `{String} modelPath`:模型路径
  335. - `{Object} style`:样式,详情参考:[DC.Model](./overlay-vector#dc-model)
  336. - 返回值 `this`
  337. - **_setBillboard(icon,style)_**
  338. 设置图标
  339. - 参数
  340. - `{String} icon`:图标路径
  341. - `{Object} style`:样式,参考:[DC.Billboard](./overlay-vector#dc-billboard)
  342. - 返回值 `this`
  343. - **_setLabel(text,style)_**
  344. 设置文本
  345. - 参数
  346. - `{String} text`:文本
  347. - `{Object} style`:样式,参考:[DC.Label](./overlay-vector#dc-label)
  348. - 返回值 `this`
  349. - **_setPath(visible,style)_**
  350. 设置路径
  351. - 参数
  352. - `{Boolean}} visible`:是否可见
  353. - `{Object} style`:样式,参考:[DC.Polyline](./overlay-vector#dc-polyline)
  354. - 返回值 `this`