|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- ---
- sidebar: auto
- ---
-
- # Effects 🌎
-
- Add dynamic elements to the 3D scene to allow the scene to move and run more closely to the real world
-
- ## DC.Weather
-
- ### example
-
- ```js
- let weather = new DC.Weather(viewer)
- ```
-
- ### creation
-
- - **_constructor()_**
-
- - Returns `weather`
-
- ### properties
-
- - [`{Rain} rain`](#rain)**_`readonly`_**
- - [`{Snow} snow`](#snow) **_`readonly`_**
- - [`{Fog} snow`](#fog) **_`readonly`_**
- - [`{Cloud} cloud`](#cloud) **_`readonly`_**
-
- ## Rain
-
- ### example
-
- ```js
- viewer.weather.rain.enable = true
- viewer.weather.rain.speed = 2
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} speed`
-
- ## Snow
-
- ### example
-
- ```js
- viewer.weather.snow.enable = true
- viewer.weather.snow.speed = 2
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} speed`
-
- ## Fog
-
- ### example
-
- ```js
- viewer.weather.fog.enable = true
- viewer.weather.fog.fogColor = DC.Color.BLACK
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Color} fogColor
- - `{Object} fogByDistance`: { near: 10, nearValue: 0, far: 2000, farValue: 1.0 }
-
- ## Cloud
-
- ### example
-
- ```js
- viewer.weather.cloud.enable = true
- viewer.weather.cloud.rotateAmount = 0.02
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} rotateAmount`
-
- ## DC.Effect
-
- ### example
-
- ```js
- let effect = new DC.Effect()
- viewer.use(effect)
- ```
-
- ### creation
-
- - **_constructor()_**
-
- - Returns `effect`
-
- ### properties
-
- - [`{BlackAndWhite} blackAndWhite`](#blackandwhite) **_`readonly`_**
- - [`{Bloom} bloom`](#bloom) **_`readonly`_**
- - [`{Brightness} brightness`](#brightness)**_`readonly`_**
- - [`{DepthOfField} depthOfField`](#depthoffield) **_`readonly`_**
- - [`{LensFlare} lensFlare`](#lensflare) **_`readonly`_**
- - [`{Night} night`](#night) **_`readonly`_**
- - [`{Silhouette} silhouette`](#silhouette) **_`readonly`_**
-
- ## BlackAndWhite
-
- ### example
-
- ```js
- viewer.effect.blackAndWhite.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} gradations`
- - `{Array} selected`
-
- ## Bloom
-
- ### example
-
- ```js
- viewer.effect.bloom.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} contrast`
- - `{Number} brightness`
- - `{Number} glowOnly`
- - `{Number} delta`
- - `{Number} sigma`
- - `{Number} stepSize`
- - `{Array} selected`
-
- ## Brightness
-
- ### example
-
- ```js
- viewer.effect.brightness.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} intensity`
- - `{Array} selected`
-
- ## DepthOfField
-
- ### example
-
- ```js
- viewer.effect.depthOfField.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number}} focalDistance`
- - `{Number} delta`
- - `{Number} sigma`
- - `{Number} stepSize`
- - `{Array} selected`
-
- ## LensFlare
-
- ### example
-
- ```js
- viewer.effect.lensFlare.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number}} intensity`
- - `{Number} distortion`
- - `{Number} dirtAmount`
- - `{Number} haloWidth`
- - `{Array} selected`
-
- ## Night
-
- ### example
-
- ```js
- viewer.effect.night.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Array} selected`
-
- ## Silhouette
-
- ### example
-
- ```js
- viewer.effect.silhouette.enable = true
- ```
-
- ### properties
-
- - `{Boolean} enable`
- - `{Color} color`
- - `{Number} length`
- - `{Array} selected`
-
- ## Animation
-
- > Animation base class
-
- :::warning
- The class cannot be instantiated
- :::
-
- ### methods
-
- - **_start()_**
-
- - returns `this`
-
- - **_stop()_**
-
- - returns `this`
-
- ## DC.AroundPoint
-
- > Inherited from [Animation](#animation)
-
- ### example
-
- ```js
- let aroundPoint = new DC.AroundPoint(viewer, '120.121, 31.12')
- aroundPoint.start()
- ```
-
- ### creation
-
- - **_constructor(viewer,position,[options])_**
-
- - parameters
- - `{Viewer} viewer`
- - `{Position|String|Array} position`
- - `{Object} options`
- - returns `aroundPoint`
-
- ```json
- //options(optional)
- {
- "heading": 0,
- "pitch": 0,
- "range": 0,
- "duration": 0,
- "callback": null,
- "context": null
- }
- ```
-
- ## DC.AroundView
-
- > Inherited from [Animation](#animation)
-
- ### example
-
- ```js
- let aroundView = new DC.AroundView(viewer)
- aroundView.start()
- ```
-
- ### creation
-
- - **_constructor(viewer,options)_**
-
- - parameters
- - `{Viewer} viewer`
- - `{Object} options`
- - returns `aroundView`
-
- ```json
- //options(optional)
- {
- "heading": 0,
- "duration": 0,
- "pitch": 0,
- "roll": 0,
- "callback": null,
- "context": null
- }
- ```
-
- ## DC.CircleScan
-
- > Inherited from [Animation](#animation)
-
- ### example
-
- ```js
- let circleScan = new DC.CircleScan(viewer, '120, 20', 200)
- circleScan.start()
- ```
-
- ### creation
-
- - **_constructor(viewer,position,radius,[options])_**
-
- - parameters
- - `{Viewer} viewer`:场景
- - `{DC.Position} position`:位置
- - `{Number} radius`:半径
- - `{Object} options`:属性
- - returns `circleScan`
-
- ```json
- //options(optional)
- {
- "color": DC.Color.BLUE,
- "speed": 5
- }
- ```
-
- ## DC.Flying
-
- > Inherited from [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)_**
-
- - parameters
- - `{Viewer} viewer`:场景
- - `{Object} options`:options
- - returns `flying`
-
- ```json
- //options(optional)
- {
- "loop": false,
- "dwellTime": 3,
- "callback": null
- }
- ```
-
- ### properties
-
- - `{Array} positions`
- - `{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
-
- ### methods
-
- - **_start()_**
-
- - returns `this`
-
- - **_pause()_**
-
- - returns `this`
-
- - **_restore()_**
-
- - returns `this`
-
- ## DC.GlobeRotate
-
- > Inherited from [Animation](#animation)
-
- ### example
-
- ```js
- let globeRotate = new DC.GlobeRotate(viewer, {
- duration: 5,
- speed: 1000,
- callback: () => {},
- })
- globeRotate.start()
- ```
-
- ### creation
-
- - **_constructor(viewer,[options])_**
-
- - parameters
- - `{DC.Viewer} viewer`
- - `{Object} options`
- - returns `globeRotate`
-
- ```json
- //options(optional)
- {
- "speed": 12 * 1000,
- "duration": 0,
- "callback": null,
- "context": null
- }
- ```
-
- ## DC.RadarScan
-
- > Inherited from [Animation](#animation)
-
- ### example
-
- ```js
- let radarScan = new DC.RadarScan(viewer, '120, 20', 200)
- radarScan.start()
- ```
-
- ### creation
-
- - **_constructor(viewer,position,radius,options)_**
-
- - parameters
- - `{Viewer} viewer`
- - `{DC.Position} position`
- - `{Number} radius`
- - `{Object} options`
- - returns `radarScan`
-
- ```json
- //options(optional)
- {
- "color": DC.Color.BLUE,
- "speed": 5
- }
- ```
-
- ## DC.RoamingController
-
- ### example
-
- ```js
- let rc = new DC.RoamingController(viewer)
- ```
-
- ### creation
-
- - **_constructor(viewer)_**
-
- - parameters
- - `{Viewer} viewer`
- - returns `roamingController`
-
- ### methods
-
- - **_addPath(path)_**
-
- - parameters
- - `{RoamingPath} path`
- - returns `this`
-
- - **_addPaths(paths)_**
-
- - parameters
- - `{Array<RoamingPath>} paths`
- - returns `this`
-
- - **_removePath(path)_**
-
- - parameters
- - `{RoamingPath} path`
- - returns `path`
-
- - **_getPath(id)_**
-
- - parameters
- - `{String} id`
- - returns `path`
-
- - **_getPaths()_**
-
- - returns `array`
-
- - **_activate(path, viewOption)_**
-
- - parameters
- - `{RoamingPath} path`
- - `{String} viewOption`
- - returns `this`
-
- ```json
- // options (optional)
- {
- "pitch": 0,
- "range": 1000
- }
- ```
-
- - **_deactivate()_**
-
- - returns `this`
-
- - **_clear()_**
-
- - returns `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])_**
-
- - parameters
- - `{String|Array<Position|Number|String|Object>} positions`
- - `{Number} duration`
- - `{String} pathMode` speed / time
- - returns `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)_**
-
- - parameters
- - `{Viewer} viewer`
- - returns `keyboardRoaming`
-
- ### properties
-
- - `{Boolean} enable`
- - `{Number} moveRate` default: 100
- - `{Number} rotateRate` default: 0.01
-
- ## DC.TrackController
-
- ### example
-
- ```js
- let tc = new DC.TrackController(viewer)
- ```
-
- ### creation
-
- - **_constructor(viewer)_**
-
- - parameters
- - `{Viewer} viewer`
- - returns `trackController`
-
- ### methods
-
- - **_addTrack(track)_**
-
- - parameters
- - `{Track} track`
- - returns `this`
-
- - **_addTracks(tracks)_**
-
- - parameters
- - `{Array<Track>} tracks`
- - returns `this`
-
- - **_removeTrack(track)_**
-
- - parameters
- - `{Track} track`
- - returns `path`
-
- - **_getTrack(id)_**
-
- - parameters
- - `{String} id`
- - returns `track`
-
- - **_getTracks()_**
-
- - returns `array`
-
- - **_play()_**
-
- - returns `this`
-
- - **_pause()_**
-
- - returns `this`
-
- - **_restore()_**
-
- - returns `this`
-
- - **_viewTrack(track, viewOption)_**
-
- - parameters
- - `{Track} track`
- - `{String} viewOption`
- - returns `this`
-
- ```json
- // options (optional)
- {
- "mode": null, // DC.TrackViewMode
- "pitch": 0,
- "range": 1000
- }
- ```
-
- - **_releaseTrack(track)_**
-
- - parameters
- - `{Track} track`:路径
- - returns `this`
-
- - **_clear()_**
-
- - returns `this`
-
- ## DC.Track
-
- ### example
-
- ```js
- let track = new DC.Track('120.121,32.1213;121.132,32.1213', 20)
- rc.addTrack(track)
- ```
-
- ### creation
-
- - **_constructor(positions, duration, [callback], [options])_**
-
- - parameters
- - `{String|Array<Position|Number|String|Object>} positions`
- - `{Number} duration`
- - `{Function} callback`:Each point arrival callback function, parameters are: position, isLast
- - `{Object} options`
- - returns `track`
-
- ```json
- // options (optional)
- {
- "clampToGround": false,
- "clampToTileset": false,
- "interpolationType": "Linear", // Linear、Hermite、Lagrange
- "interpolationDegree": 2,
- "endDelayTime": 0.5 // End time extension time, unit:second
- }
- ```
-
- ### properties
-
- - `{String} trackId` **_`readonly`_**
- - `{String} id`
- - `{String|Array<Position|Number|String|Object>} positions`
- - `{Number} duration`
- - `{Date} startTime`
- - `{String} state` **_`readonly`_**
-
- ### methods
-
- - **_addPosition(position,duration)_**
-
- - parameters
- - `{Position|Array|String|Object} position`
- - `{Number} duration`
- - returns `this`
-
- - **_setModel(modelUrl,style)_**
-
- - parameters
- - `{String} modelPath`
- - `{Object} style` [DC.Model](../dc-sdk/#dc-model)
- - returns `this`
-
- - **_setBillboard(icon,style)_**
-
- - parameters
- - `{String} icon`
- - `{Object} style` [DC.Billboard](../dc-sdk/#dc-billboard)
- - returns `this`
-
- - **_setLabel(text,style)_**
-
- - parameters
- - `{String} text`
- - `{Object} style` [DC.Label](../dc-sdk/#dc-label)
- - returns `this`
-
- - **_setPath(visible,style)_**
-
- - parameters
- - `{Boolean}} visible`
- - `{Object} style` [DC.Polyline](../dc-sdk/#dc-polyline)
- - returns `this`
|