# Light `[Client]`

Light is a powerful module to create and manage dynamic light sources with smooth transitions in your RedM script. It allows for easily creating, moving, and fading lights with full control over color, intensity, and range.

::: tip Tips for using lights :

- **Performance**: Lights are relatively expensive to render. Keep the number of active lights to a minimum.
- **Range**: Smaller light ranges (5-15 units) often look better and are more efficient.
- **Transitions**: The `ease` parameter allows for smooth transitions when changing properties, creating more natural-looking effects.
- **Colors**: Different colors create different moods - warm colors (orange, yellow) for fires, cool colors (blue, cyan) for magical effects, etc.

:::

## JO Functions

### jo.light.create()

Creates a new light with the given properties <br>

#### Syntax

```lua
jo.light.create(coords, intensity, rgb, range, ease)
```

#### Parameters

`coords` : _vector3_
> The position where the light will be created
>

`intensity` : _float_ `[Optional]`
> The light intensity from 0.0 to 1.0 - default:1.0
>

`rgb` : _table_ `[Optional]`

> RGB color values as a table {r,g,b} - default:`{255, 160, 122}`
>

`range` : _float_ `[Optional]`
> The range/radius of the light - default:10.0
>

`ease` : _float_ `[Optional]`
> Transition time in milliseconds - default:1000
>

#### Return Value

Type : _[LightClass](#lightclass-methods)_

> The created light object

## LightClass Methods

### LightClass:delete()

Marks a light for deletion and starts fading it out <br>

#### Syntax

```lua
LightClass:delete()
```

---

### LightClass:setCoords()

Sets new target coordinates for the light <br>

#### Syntax

```lua
LightClass:setCoords(coords)
```

#### Parameters

`coords` : _vector3_
> The new target position
>

---

### LightClass:setIntensity()

Sets new target intensity for the light <br>

#### Syntax

```lua
LightClass:setIntensity(intensity)
```

#### Parameters

`intensity` : _float_
> The new target intensity from 0.0 to 1.0
>

---

### LightClass:update()

Updates the light properties based on elapsed time <br>

#### Syntax

```lua
LightClass:update(deltaTime)
```

#### Parameters

`deltaTime` : _float_
> Time elapsed since last update in ms
>
