# Animation `[Client]`

Animation is a powerfull module to play animations in your script.

## JO Variables

### jo.animation.easeIn
Type : *float*:  
> A variable to set the ease **in** speed of animations  
> Default: 4.0

### jo.animation.easeOut
Type : *float*  
> A variable to set the ease **out** speed of animations  
> Default: -4.0

## JO Functions

### jo.animation.faceEntity()

Turn the ped to face the target <br>

#### Syntax

```lua
jo.animation.faceEntity(ped, target, waiter)
```

#### Parameters

`ped` : _integer_
> The ped to turn
>

`target` : _integer_
> The target to face
>

`waiter` : _boolean_ `[Optional]`
> If need to reach the heading to end the function - default:true
>

---

### jo.animation.goToCoords()

Function to move a ped to a destination <br>

#### Syntax

```lua
jo.animation.goToCoords(ped, coords, speed, waiter, distanceToStop)
```

#### Parameters

`ped` : _integer_
> The ped to move
>

`coords` : _vector_
> vec3 or vec4 - The coordinate of the destination <br> If vector4 is used, the ped will stop at the end and turn to the desired heading
>

`speed` : _number_ `[Optional]`
> The speed of the walk - default:1.0
>

`waiter` : _boolean_ `[Optional]`
> If need to wait the reach of location to end the function - default:false
>

`distanceToStop` : _number_ `[Optional]`
> The distance between the ped and the destination to stop it - default:0.0
>

---

### jo.animation.load()

Load the dictionnary of animation <br>

#### Syntax

```lua
jo.animation.load(dict, waiter)
```

#### Parameters

`dict` : _string_
> The dictionnary of the animation
>

`waiter` : _boolean_ `[Optional]`
> If need to wait the loading to end the function - default:false
>

---

### jo.animation.play()

Play animation. The function load automatically necessary resources. <br>

#### Syntax

```lua
jo.animation.play(ped, dict, name, duration, flag, offset)
```

#### Parameters

`ped` : _integer_
> The entity where the animation will be played
>

`dict` : _string_
> The dictionnary of the animation
>

`name` : _string_
> The name of the animation
>

`duration` : _integer_ `[Optional]`
> Duration of the animation in ms - default:-1
>

`flag` : _integer|table_ `[Optional]`
> Animation flags - default:0. Pass an integer value or a table of bit indices (e.g. {0,3}
>

`offset` : _number_ `[Optional]`
> The offset of the animation 0.0 <> 1.0 - default: 0.0
>

#### Return Value

Type : _number_

---

### jo.animation.setDesiredHeading()

Turn the ped to the desired heading <br>

#### Syntax

```lua
jo.animation.setDesiredHeading(ped, heading, waiter)
```

#### Parameters

`ped` : _integer_
> The ped to turn
>

`heading` : _number_
> The desired heading
>

`waiter` : _boolean_ `[Optional]`
> If need to reach the heading to end the function - default:true
>

---

### jo.animation.waitTaskEnd()

#### Syntax

```lua
jo.animation.waitTaskEnd(ped, task)
```
