# Animation

### Register

`MTools.Animation.Register(name, reload);`

| Name   | Type      | Description                                      |
| ------ | --------- | ------------------------------------------------ |
| name   | `string`  | Group name.                                      |
| reload | `boolean` | Does it need to be restarted. The advice is nil. |

**Allows you to register groups for animations.**\
\ <mark style="color:green;">**Example usage:**</mark>

```lua
MTools.Animation:Register("MTools");
-- Registers the MTools group.
```

### Update

`MTools.Animation.Update(name, speed);`

| Name  | Type     | Description                   |
| ----- | -------- | ----------------------------- |
| name  | `string` | Name of the registered group. |
| speed | `number` | Animation speed. Advised 7.5. |

**Allows you to update an animation group.**\
\ <mark style="color:green;">**Example usage:**</mark>

<pre class="language-lua"><code class="lang-lua"><strong>MTools.Animation:Update("MTools", 5);
</strong>-- Updates the MTools group at 5 speed.
</code></pre>

### Lerp

`MTools.Animation.Lerp(group, name, bool, from, to, speed);`

<table><thead><tr><th width="259">Name</th><th width="259.3333333333333">Type</th><th width="250.66666666666669">Description</th></tr></thead><tbody><tr><td>group</td><td><code>string</code></td><td>Group name.</td></tr><tr><td>name</td><td><code>string</code></td><td>Animation title. (Any)</td></tr><tr><td>bool</td><td><code>boolean</code></td><td>false - up. true - down.</td></tr><tr><td>from</td><td><code>(type)Below</code></td><td>From what (type). The recommendation is nil.</td></tr><tr><td>to</td><td><code>(type)Below</code></td><td>Until what (type). The recommendation is nil.</td></tr><tr><td>speed</td><td><code>number</code></td><td>Animation speed. Works only for animation of Colors, Tables, Vectors.</td></tr></tbody></table>

**Allows you to animate Numbers, Colors, Vectors, Tables.**\
\ <mark style="color:green;">**Example usage:**</mark>

<details>

<summary>Number</summary>

```lua
MTools.Animation:Register("MTools");
MTools.Animation:Update("MTools", 6);
local Number = MTools.Animation:Lerp("MTools", "Number", (globals.tickcount % 80 >= 40), 0, 1);
print(Number);
-- Creates an MTools group, gives the group 6 speed.
-- Animates a number from 0 to 1 at speed 6.
```

</details>

<details>

<summary>Color</summary>

```lua
MTools.Animation:Register("MTools");
MTools.Animation:Update("MTools", 6);
local Color = MTools.Animation:Lerp("MTools", "Color", (globals.tickcount % 80 >= 40), color(0, 0, 0, 255), color(255, 255, 255, 255));
print(Color);
-- Creates an MTools group, gives the group 6 speed.
-- Animates the color from black to white at speed 6.
```

</details>

<details>

<summary>Vector</summary>

```lua
MTools.Animation:Register("MTools");
MTools.Animation:Update("MTools", 6);
local Vector = MTools.Animation:Lerp("MTools", "Vector", (globals.tickcount % 80 >= 40), vector(0, 0, 0), vector(10, 10, 10));
print(Vector);
-- Creates an MTools group, gives the group 6 speed.
-- Animates the vector from (0, 0, 0) to (10, 10, 10) at speed 6.
-- A vector may NOT contain the variable Z(3).
```

</details>

<details>

<summary>Table</summary>

```lua
MTools.Animation:Register("MTools");
MTools.Animation:Update("MTools", 6);
local Table = MTools.Animation:Lerp("MTools", "Table", (globals.tickcount % 80 >= 40), { 0, 0, 0 }, { 10, 10, 10 });
print(Table);
-- Creates an MTools group, gives the group 6 speed.
-- Animates the table from (0, 0, 0) to (10, 10, 10) at speed 6.
-- Arrays can contain any number of objects.
```

</details>
