Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. ---
  2. sidebar: auto
  3. ---
  4. # Effects 🌎
  5. Add dynamic elements to the 3D scene to allow the scene to move and run more closely to the real world
  6. ## DC.Weather
  7. ### example
  8. ```js
  9. let weather = new DC.Weather()
  10. viewer.use(weather)
  11. ```
  12. ### creation
  13. - **_constructor()_**
  14. - Returns `weather`
  15. ### properties
  16. - [`{Rain} rain`](#rain)**_`readonly`_**
  17. - [`{Snow} snow`](#snow) **_`readonly`_**
  18. - [`{Fog} snow`](#fog) **_`readonly`_**
  19. - [`{Cloud} cloud`](#cloud) **_`readonly`_**
  20. ## Rain
  21. ### example
  22. ```js
  23. viewer.weather.rain.enable = true
  24. viewer.weather.rain.speed = 2
  25. ```
  26. ### properties
  27. - `{Boolean} enable`
  28. - `{Number} speed`
  29. ## Snow
  30. ### example
  31. ```js
  32. viewer.weather.snow.enable = true
  33. viewer.weather.snow.speed = 2
  34. ```
  35. ### properties
  36. - `{Boolean} enable`
  37. - `{Number} speed`
  38. ## Fog
  39. ### example
  40. ```js
  41. viewer.weather.fog.enable = true
  42. viewer.weather.fog.fogColor = DC.Color.BLACK
  43. ```
  44. ### properties
  45. - `{Boolean} enable`
  46. - `{Color} fogColor
  47. - `{Object} fogByDistance`: { near: 10, nearValue: 0, far: 2000, farValue: 1.0 }
  48. ## Cloud
  49. ### example
  50. ```js
  51. viewer.weather.cloud.enable = true
  52. viewer.weather.cloud.rotateAmount = 0.02
  53. ```
  54. ### properties
  55. - `{Boolean} enable`
  56. - `{Number} rotateAmount`
  57. ## DC.Effect
  58. ### example
  59. ```js
  60. let effect = new DC.Effect()
  61. viewer.use(effect)
  62. ```
  63. ### creation
  64. - **_constructor()_**
  65. - Returns `effect`
  66. ### properties
  67. - [`{BlackAndWhite} blackAndWhite`](#blackandwhite) **_`readonly`_**
  68. - [`{Bloom} bloom`](#bloom) **_`readonly`_**
  69. - [`{Brightness} brightness`](#brightness)**_`readonly`_**
  70. - [`{DepthOfField} depthOfField`](#depthoffield) **_`readonly`_**
  71. - [`{LensFlare} lensFlare`](#lensflare) **_`readonly`_**
  72. - [`{Night} night`](#night) **_`readonly`_**
  73. - [`{Silhouette} silhouette`](#silhouette) **_`readonly`_**
  74. ## BlackAndWhite
  75. ### example
  76. ```js
  77. viewer.effect.blackAndWhite.enable = true
  78. ```
  79. ### properties
  80. - `{Boolean} enable`
  81. - `{Number} gradations`
  82. - `{Array} selected`
  83. ## Bloom
  84. ### example
  85. ```js
  86. viewer.effect.bloom.enable = true
  87. ```
  88. ### properties
  89. - `{Boolean} enable`
  90. - `{Number} contrast`
  91. - `{Number} brightness`
  92. - `{Number} glowOnly`
  93. - `{Number} delta`
  94. - `{Number} sigma`
  95. - `{Number} stepSize`
  96. - `{Array} selected`
  97. ## Brightness
  98. ### example
  99. ```js
  100. viewer.effect.brightness.enable = true
  101. ```
  102. ### properties
  103. - `{Boolean} enable`
  104. - `{Number} intensity`
  105. - `{Array} selected`
  106. ## DepthOfField
  107. ### example
  108. ```js
  109. viewer.effect.depthOfField.enable = true
  110. ```
  111. ### properties
  112. - `{Boolean} enable`
  113. - `{Number}} focalDistance`
  114. - `{Number} delta`
  115. - `{Number} sigma`
  116. - `{Number} stepSize`
  117. - `{Array} selected`
  118. ## LensFlare
  119. ### example
  120. ```js
  121. viewer.effect.lensFlare.enable = true
  122. ```
  123. ### properties
  124. - `{Boolean} enable`
  125. - `{Number}} intensity`
  126. - `{Number} distortion`
  127. - `{Number} dirtAmount`
  128. - `{Number} haloWidth`
  129. - `{Array} selected`
  130. ## Night
  131. ### example
  132. ```js
  133. viewer.effect.night.enable = true
  134. ```
  135. ### properties
  136. - `{Boolean} enable`
  137. - `{Array} selected`
  138. ## Silhouette
  139. ### example
  140. ```js
  141. viewer.effect.silhouette.enable = true
  142. ```
  143. ### properties
  144. - `{Boolean} enable`
  145. - `{Color} color`
  146. - `{Number} length`
  147. - `{Array} selected`
  148. ## Animation
  149. > Animation base class
  150. :::warning
  151. The class cannot be instantiated
  152. :::
  153. ### methods
  154. - **_start()_**
  155. - returns `this`
  156. - **_stop()_**
  157. - returns `this`
  158. ## DC.AroundPoint
  159. > Inherited from [Animation](#animation)
  160. ### example
  161. ```js
  162. let aroundPoint = new DC.AroundPoint(viewer, '120.121, 31.12')
  163. aroundPoint.start()
  164. ```
  165. ### creation
  166. - **_constructor(viewer,position,[options])_**
  167. - parameters
  168. - `{Viewer} viewer`
  169. - `{Position|String|Array} position`
  170. - `{Object} options`
  171. - returns `aroundPoint`
  172. ```json
  173. //options(optional)
  174. {
  175. "heading": 0,
  176. "pitch": 0,
  177. "range": 0,
  178. "duration": 0,
  179. "callback": null,
  180. "context": null
  181. }
  182. ```
  183. ## DC.AroundView
  184. > Inherited from [Animation](#animation)
  185. ### example
  186. ```js
  187. let aroundView = new DC.AroundView(viewer)
  188. aroundView.start()
  189. ```
  190. ### creation
  191. - **_constructor(viewer,options)_**
  192. - parameters
  193. - `{Viewer} viewer`
  194. - `{Object} options`
  195. - returns `aroundView`
  196. ```json
  197. //options(optional)
  198. {
  199. "heading": 0,
  200. "duration": 0,
  201. "pitch": 0,
  202. "roll": 0,
  203. "callback": null,
  204. "context": null
  205. }
  206. ```
  207. ## DC.CircleScan
  208. > Inherited from [Animation](#animation)
  209. ### example
  210. ```js
  211. let circleScan = new DC.CircleScan(viewer, '120, 20', 200)
  212. circleScan.start()
  213. ```
  214. ### creation
  215. - **_constructor(viewer,position,radius,[options])_**
  216. - parameters
  217. - `{Viewer} viewer`:场景
  218. - `{DC.Position} position`:位置
  219. - `{Number} radius`:半径
  220. - `{Object} options`:属性
  221. - returns `circleScan`
  222. ```json
  223. //options(optional)
  224. {
  225. "color": DC.Color.BLUE,
  226. "speed": 5
  227. }
  228. ```
  229. ## DC.Flying
  230. > Inherited from [Animation](#animation)
  231. ### example
  232. ```js
  233. let flying = new DC.Flying(viewer)
  234. flying.positions = ['121.234,21.212,0,-29', '121.435,21.212,0,-29']
  235. flying.start()
  236. ```
  237. ### creation
  238. - **_constructor(viewer,options)_**
  239. - parameters
  240. - `{Viewer} viewer`:场景
  241. - `{Object} options`:options
  242. - returns `flying`
  243. ```json
  244. //options(optional)
  245. {
  246. "loop": false,
  247. "dwellTime": 3,
  248. "callback": null
  249. }
  250. ```
  251. ### properties
  252. - `{Array} positions`
  253. - `{Array} durations`: The flight interval of each point, when the length of the array is 1, each interval is the same, if not 1, the length must be equal to the length of the point
  254. ### methods
  255. - **_start()_**
  256. - returns `this`
  257. - **_pause()_**
  258. - returns `this`
  259. - **_restore()_**
  260. - returns `this`
  261. ## DC.GlobeRotate
  262. > Inherited from [Animation](#animation)
  263. ### example
  264. ```js
  265. let globeRotate = new DC.GlobeRotate(viewer, {
  266. duration: 5,
  267. speed: 1000,
  268. callback: () => {},
  269. })
  270. globeRotate.start()
  271. ```
  272. ### creation
  273. - **_constructor(viewer,[options])_**
  274. - parameters
  275. - `{DC.Viewer} viewer`
  276. - `{Object} options`
  277. - returns `globeRotate`
  278. ```json
  279. //options(optional)
  280. {
  281. "speed": 12 * 1000,
  282. "duration": 0,
  283. "callback": null,
  284. "context": null
  285. }
  286. ```
  287. ## DC.RadarScan
  288. > Inherited from [Animation](#animation)
  289. ### example
  290. ```js
  291. let radarScan = new DC.RadarScan(viewer, '120, 20', 200)
  292. radarScan.start()
  293. ```
  294. ### creation
  295. - **_constructor(viewer,position,radius,options)_**
  296. - parameters
  297. - `{Viewer} viewer`
  298. - `{DC.Position} position`
  299. - `{Number} radius`
  300. - `{Object} options`
  301. - returns `radarScan`
  302. ```json
  303. //options(optional)
  304. {
  305. "color": DC.Color.BLUE,
  306. "speed": 5
  307. }
  308. ```
  309. ## DC.RoamingController
  310. ### example
  311. ```js
  312. let rc = new DC.RoamingController(viewer)
  313. ```
  314. ### creation
  315. - **_constructor(viewer)_**
  316. - parameters
  317. - `{Viewer} viewer`
  318. - returns `roamingController`
  319. ### methods
  320. - **_addPath(path)_**
  321. - parameters
  322. - `{RoamingPath} path`
  323. - returns `this`
  324. - **_addPaths(paths)_**
  325. - parameters
  326. - `{Array<RoamingPath>} paths`
  327. - returns `this`
  328. - **_removePath(path)_**
  329. - parameters
  330. - `{RoamingPath} path`
  331. - returns `path`
  332. - **_getPath(id)_**
  333. - parameters
  334. - `{String} id`
  335. - returns `path`
  336. - **_getPaths()_**
  337. - returns `array`
  338. - **_activate(path, viewOption)_**
  339. - parameters
  340. - `{RoamingPath} path`
  341. - `{String} viewOption`
  342. - returns `this`
  343. ```json
  344. // options (optional)
  345. {
  346. "pitch": 0,
  347. "range": 1000
  348. }
  349. ```
  350. - **_deactivate()_**
  351. - returns `this`
  352. - **_clear()_**
  353. - returns `this`
  354. ## DC.RoamingPath
  355. ### example
  356. ```js
  357. let path = new DC.RoamingPath('120.121,32.1213;121.132,32.1213', 20)
  358. rc.addPath(path)
  359. ```
  360. ### creation
  361. - **_constructor(positions, duration, [pathMode])_**
  362. - parameters
  363. - `{String|Array<Position|Number|String|Object>} positions`
  364. - `{Number} duration`
  365. - `{String} pathMode` speed / time
  366. - returns `roamingPath`
  367. ### properties
  368. - `{String} pathId` **_`readonly`_**
  369. - `{String} id`
  370. - `{String|Array<Position|Number|String>} positions`
  371. - `{Number} duration`
  372. - `{String} pathMode` speed / time
  373. - `{String} state` **_`readonly`_**
  374. ## DC.KeyboardRoaming
  375. ### example
  376. ```js
  377. let kr = new DC.KeyboardRoaming(viewer)
  378. kr.enable = true
  379. ```
  380. ### creation
  381. - **_constructor(viewer)_**
  382. - parameters
  383. - `{Viewer} viewer`
  384. - returns `keyboardRoaming`
  385. ### properties
  386. - `{Boolean} enable`
  387. - `{Number} moveRate` default: 100
  388. - `{Number} rotateRate` default: 0.01
  389. ## DC.TrackController
  390. ### example
  391. ```js
  392. let tc = new DC.TrackController(viewer)
  393. ```
  394. ### creation
  395. - **_constructor(viewer)_**
  396. - parameters
  397. - `{Viewer} viewer`
  398. - returns `trackController`
  399. ### methods
  400. - **_addTrack(track)_**
  401. - parameters
  402. - `{Track} track`
  403. - returns `this`
  404. - **_addTracks(tracks)_**
  405. - parameters
  406. - `{Array<Track>} tracks`
  407. - returns `this`
  408. - **_removeTrack(track)_**
  409. - parameters
  410. - `{Track} track`
  411. - returns `path`
  412. - **_getTrack(id)_**
  413. - parameters
  414. - `{String} id`
  415. - returns `track`
  416. - **_getTracks()_**
  417. - returns `array`
  418. - **_play()_**
  419. - returns `this`
  420. - **_pause()_**
  421. - returns `this`
  422. - **_restore()_**
  423. - returns `this`
  424. - **_viewTrack(track, viewOption)_**
  425. - parameters
  426. - `{Track} track`
  427. - `{String} viewOption`
  428. - returns `this`
  429. ```json
  430. // options (optional)
  431. {
  432. "mode": null, // DC.TrackViewMode
  433. "pitch": 0,
  434. "range": 1000
  435. }
  436. ```
  437. - **_releaseTrack(track)_**
  438. - parameters
  439. - `{Track} track`:路径
  440. - returns `this`
  441. - **_clear()_**
  442. - returns `this`
  443. ## DC.Track
  444. ### example
  445. ```js
  446. let track = new DC.Track('120.121,32.1213;121.132,32.1213', 20)
  447. rc.addTrack(track)
  448. ```
  449. ### creation
  450. - **_constructor(positions, duration, [callback], [options])_**
  451. - parameters
  452. - `{String|Array<Position|Number|String|Object>} positions`
  453. - `{Number} duration`
  454. - `{Function} callback`:Each point arrival callback function, parameters are: position, isLast
  455. - `{Object} options`
  456. - returns `track`
  457. ```json
  458. // options (optional)
  459. {
  460. "clampToGround": false,
  461. "clampToTileset": false,
  462. "interpolationType": "Linear", // Linear、Hermite、Lagrange
  463. "interpolationDegree": 2,
  464. "endDelayTime": 0.5 // End time extension time, unit:second
  465. }
  466. ```
  467. ### properties
  468. - `{String} trackId` **_`readonly`_**
  469. - `{String} id`
  470. - `{String|Array<Position|Number|String|Object>} positions`
  471. - `{Number} duration`
  472. - `{Date} startTime`
  473. - `{String} state` **_`readonly`_**
  474. ### methods
  475. - **_addPosition(position,duration)_**
  476. - parameters
  477. - `{Position|Array|String|Object} position`
  478. - `{Number} duration`
  479. - returns `this`
  480. - **_setModel(modelUrl,style)_**
  481. - parameters
  482. - `{String} modelPath`
  483. - `{Object} style` [DC.Model](../dc-sdk/#dc-model)
  484. - returns `this`
  485. - **_setBillboard(icon,style)_**
  486. - parameters
  487. - `{String} icon`
  488. - `{Object} style` [DC.Billboard](../dc-sdk/#dc-billboard)
  489. - returns `this`
  490. - **_setLabel(text,style)_**
  491. - parameters
  492. - `{String} text`
  493. - `{Object} style` [DC.Label](../dc-sdk/#dc-label)
  494. - returns `this`
  495. - **_setPath(visible,style)_**
  496. - parameters
  497. - `{Boolean}} visible`
  498. - `{Object} style` [DC.Polyline](../dc-sdk/#dc-polyline)
  499. - returns `this`