# TilesFadePluginBase

class in `3d-tiles-renderer/core/plugins`

```js
import { TilesFadePluginBase } from '3d-tiles-renderer/core/plugins';
```

Base class for plugins that fade tile geometry in and out as tile LODs change. Dispatches
`fade-change`, `fade-start`, and `fade-end` events on the `TilesRenderer`. Subclasses
implement the engine specific hooks below.

## Constructor

```js
new TilesFadePluginBase( options?: Object )
```

- `options`, `Object`, optional
  - `fadeDuration`, `number`, optional, default `250`: Time in milliseconds for a tile to fully fade in or out.
  - `maximumFadeOutTiles`, `number`, optional, default `50`: Maximum simultaneous fade-out tiles. If exceeded, tiles pop instead of fading.
  - `fadeRootTiles`, `boolean`, optional, default `false`: Whether root-level tiles fade in on their first appearance.

## Properties

### .fadeDuration: number

default `250`

Time in milliseconds for a tile to fully fade in or out.

### .fadingTiles: number

Number of tiles currently fading.

## Methods

### .prepareTileScene

```js
.prepareTileScene( scene: Object, tile: Tile ): void
```

Called when a tile model loads so its scene can be prepared for fading.

- `scene`, `Object`: The tile's engine scene.
- `tile`, `Tile`: The tile the scene belongs to.

### .releaseTileScene

```js
.releaseTileScene( scene: Object, tile: Tile ): void
```

Called when a tile model is disposed so any fade state can be released.

- `scene`, `Object`: The tile's engine scene.
- `tile`, `Tile`: The tile the scene belongs to.

### .setFadeState

```js
.setFadeState( tile: Tile, fadeIn: number, fadeOut: number ): void
```

Applies the fade values to a fading tile each update.

- `tile`, `Tile`: The tile being faded.
- `fadeIn`, `number`: Fade in progress from 0 to 1.
- `fadeOut`, `number`: Fade out progress from 0 to 1.

### .resetFadeState

```js
.resetFadeState( tile: Tile, visible: boolean ): void
```

Clears the fade values from a tile once its fade completes.

- `tile`, `Tile`: The tile that finished fading.
- `visible`, `boolean`: Whether the tile is visible after the fade.

### .updateCameraState

```js
.updateCameraState( checkMovement: boolean ): boolean
```

Tracks the camera transforms and returns whether they moved quickly since the last update.

- `checkMovement`, `boolean`: Whether to evaluate the camera movement this update.

Returns `boolean`: True if the cameras moved quickly.
